@lenne.tech/nuxt-extensions 1.6.0 → 1.7.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.
Files changed (32) hide show
  1. package/CLAUDE.md +64 -18
  2. package/README.md +72 -0
  3. package/dist/module.d.mts +1 -4
  4. package/dist/module.mjs +23 -0
  5. package/dist/runtime/composables/index.d.ts +7 -0
  6. package/dist/runtime/composables/index.js +7 -0
  7. package/dist/runtime/composables/use-lt-ai-admin.d.ts +9 -0
  8. package/dist/runtime/composables/use-lt-ai-admin.js +36 -0
  9. package/dist/runtime/composables/use-lt-ai-chat.d.ts +8 -0
  10. package/dist/runtime/composables/use-lt-ai-chat.js +141 -0
  11. package/dist/runtime/composables/use-lt-ai-connections.d.ts +7 -0
  12. package/dist/runtime/composables/use-lt-ai-connections.js +33 -0
  13. package/dist/runtime/composables/use-lt-ai-placeholders.d.ts +10 -0
  14. package/dist/runtime/composables/use-lt-ai-placeholders.js +25 -0
  15. package/dist/runtime/composables/use-lt-ai-prompts.d.ts +13 -0
  16. package/dist/runtime/composables/use-lt-ai-prompts.js +70 -0
  17. package/dist/runtime/composables/use-lt-ai-usage.d.ts +7 -0
  18. package/dist/runtime/composables/use-lt-ai-usage.js +19 -0
  19. package/dist/runtime/composables/use-lt-ai.d.ts +8 -0
  20. package/dist/runtime/composables/use-lt-ai.js +68 -0
  21. package/dist/runtime/lib/ai.d.ts +48 -0
  22. package/dist/runtime/lib/ai.js +96 -0
  23. package/dist/runtime/lib/auth-client.d.ts +8 -0
  24. package/dist/runtime/lib/index.d.ts +1 -0
  25. package/dist/runtime/lib/index.js +1 -0
  26. package/dist/runtime/plugins/auth-interceptor.client.js +26 -22
  27. package/dist/runtime/types/ai.d.ts +521 -0
  28. package/dist/runtime/types/ai.js +0 -0
  29. package/dist/runtime/types/index.d.ts +2 -1
  30. package/dist/runtime/types/module.d.ts +16 -0
  31. package/dist/types.d.mts +2 -8
  32. package/package.json +21 -14
@@ -0,0 +1,521 @@
1
+ import type { ComputedRef, DeepReadonly, Ref } from 'vue';
2
+ /** Execution mode for a prompt. `auto` = reactive agent loop, `plan` = validate-all-then-execute. */
3
+ export type LtAiMode = 'auto' | 'plan';
4
+ /**
5
+ * Input for a single AI run — sent to `POST /ai/prompt` | `POST /ai/stream`.
6
+ *
7
+ * Distinct from {@link LtAiPromptInput} (CRUD input for the user-facing
8
+ * `LtAiPrompt` entity). Pre-1.7.0 release builds called this type
9
+ * `LtAiPromptInput`; renamed to avoid a silent declaration merge with the
10
+ * CRUD input introduced for `useLtAiPrompts()`.
11
+ */
12
+ export interface LtAiPromptRunInput {
13
+ /** Confirm execution of actions that required confirmation in a previous turn. */
14
+ confirm?: boolean;
15
+ /** Id of the connection to use (omit to let the backend resolution chain decide). */
16
+ connectionId?: string;
17
+ /** Conversation id for multi-turn continuation. */
18
+ conversationId?: string;
19
+ /** Structured context the assistant should consider. */
20
+ context?: Record<string, unknown>;
21
+ /** Untrusted client metadata (current URL, navigation, console logs) for enrichment. */
22
+ metadata?: Record<string, unknown>;
23
+ /** Execution mode (defaults to the backend's `ai.defaultMode`). */
24
+ mode?: LtAiMode;
25
+ /** The user's prompt text. */
26
+ prompt: string;
27
+ /** Override the admin default for requiring confirmation of mutating actions. */
28
+ requireConfirmation?: boolean;
29
+ }
30
+ /** A tool action executed (or planned/pending) during a run. */
31
+ export interface LtAiAction {
32
+ arguments?: Record<string, any>;
33
+ name: string;
34
+ result?: any;
35
+ success?: boolean;
36
+ }
37
+ /** Token usage of a single run (best effort). */
38
+ export interface LtAiUsage {
39
+ completionTokens?: number;
40
+ promptTokens?: number;
41
+ totalTokens?: number;
42
+ }
43
+ /** Compact token-budget summary attached to every response. */
44
+ export interface LtAiBudgetSummary {
45
+ /** Effective limit (user → tenant → LLM context window → null). Null = no limit. */
46
+ maxTokens?: number;
47
+ promptTokens?: number;
48
+ remainingTokens?: number;
49
+ resetAt?: string;
50
+ /** Which scope yielded maxTokens: 'user', 'tenant' or 'llm'. */
51
+ scope?: 'llm' | 'tenant' | 'user';
52
+ usedTokens?: number;
53
+ }
54
+ /** Structured response of a prompt run (`CoreAiResponse`). */
55
+ export interface LtAiResponse {
56
+ actions?: LtAiAction[];
57
+ budget?: LtAiBudgetSummary;
58
+ connectionId?: string;
59
+ /** Context-window utilization at the end of the run (used/total tokens). */
60
+ contextWindow?: {
61
+ total: number;
62
+ used: number;
63
+ };
64
+ conversationId?: string;
65
+ data?: any;
66
+ denied?: boolean;
67
+ deniedActions?: LtAiAction[];
68
+ iterations?: number;
69
+ pendingActions?: LtAiAction[];
70
+ pendingQuestion?: {
71
+ options?: {
72
+ label: string;
73
+ value: string;
74
+ }[];
75
+ question: string;
76
+ };
77
+ plan?: LtAiAction[];
78
+ requiresConfirmation?: boolean;
79
+ text: string;
80
+ usage?: LtAiUsage;
81
+ }
82
+ /** Server-sent event emitted by `POST /ai/stream`. */
83
+ export type LtAiStreamEvent = {
84
+ action: LtAiAction;
85
+ type: 'action';
86
+ } | {
87
+ message: string;
88
+ type: 'error';
89
+ } | {
90
+ response: LtAiResponse;
91
+ type: 'final';
92
+ } | {
93
+ token: string;
94
+ type: 'token';
95
+ };
96
+ /** Callbacks for {@link UseLtAiReturn.promptStream}. */
97
+ export interface LtAiStreamHandlers {
98
+ onAction?: (action: LtAiAction) => void;
99
+ onError?: (message: string) => void;
100
+ onEvent?: (event: LtAiStreamEvent) => void;
101
+ onFinal?: (response: LtAiResponse) => void;
102
+ onToken?: (token: string) => void;
103
+ }
104
+ /** A single chat message in {@link UseLtAiChatReturn}. */
105
+ export interface LtAiMessage {
106
+ actions?: LtAiAction[];
107
+ budget?: LtAiBudgetSummary;
108
+ content: string;
109
+ createdAt?: string;
110
+ denied?: boolean;
111
+ error?: boolean;
112
+ /** Pending actions awaiting confirmation (assistant turns only). */
113
+ pendingActions?: LtAiAction[];
114
+ /** Whether this assistant turn is still streaming. */
115
+ pending?: boolean;
116
+ /** Whether this assistant turn awaits a confirmation to proceed. */
117
+ requiresConfirmation?: boolean;
118
+ role: 'assistant' | 'user';
119
+ }
120
+ /** A non-sensitive connection the current user/tenant may use. */
121
+ export interface LtAiAvailableConnection {
122
+ id: string;
123
+ isDefault?: boolean;
124
+ locked?: boolean;
125
+ model?: string;
126
+ name?: string;
127
+ selected?: boolean;
128
+ }
129
+ /** Usage for a single scope (user or tenant). */
130
+ export interface LtAiUsageScope {
131
+ maxPrompts?: number;
132
+ maxTokens?: number;
133
+ period: string;
134
+ refId?: string;
135
+ remainingPrompts?: number;
136
+ remainingTokens?: number;
137
+ resetAt?: string;
138
+ scope: string;
139
+ usedPrompts: number;
140
+ usedTokens: number;
141
+ }
142
+ /** Full usage info (`GET /ai/usage`). */
143
+ export interface LtAiUsageInfo {
144
+ tenant?: LtAiUsageScope;
145
+ user?: LtAiUsageScope;
146
+ }
147
+ /** Admin view of a connection (`apiKey` is never returned — only `hasApiKey`). */
148
+ export interface LtAiConnection {
149
+ apiKeyEnv?: string;
150
+ baseUrl?: string;
151
+ capabilities?: string[];
152
+ defaultMaxTokens?: number;
153
+ defaultTemperature?: number;
154
+ description?: string;
155
+ enabled?: boolean;
156
+ enforced?: boolean;
157
+ enforcedTenantIds?: string[];
158
+ hasApiKey?: boolean;
159
+ id: string;
160
+ isDefault?: boolean;
161
+ model?: string;
162
+ name?: string;
163
+ providerType?: string;
164
+ supportsJsonResponse?: boolean;
165
+ supportsNativeTools?: boolean;
166
+ supportsVision?: boolean;
167
+ tenantIds?: string[];
168
+ }
169
+ /** Input to create/update a connection (`apiKey`: value sets, '' clears, omit leaves). */
170
+ export interface LtAiConnectionInput {
171
+ apiKey?: string;
172
+ apiKeyEnv?: string;
173
+ baseUrl?: string;
174
+ defaultMaxTokens?: number;
175
+ defaultTemperature?: number;
176
+ description?: string;
177
+ enabled?: boolean;
178
+ enforced?: boolean;
179
+ enforcedTenantIds?: string[];
180
+ isDefault?: boolean;
181
+ model?: string;
182
+ name?: string;
183
+ providerType?: string;
184
+ supportsJsonResponse?: boolean;
185
+ supportsNativeTools?: boolean;
186
+ supportsVision?: boolean;
187
+ tenantIds?: string[];
188
+ }
189
+ /** A tenant/user connection preference. */
190
+ export interface LtAiConnectionPreference {
191
+ connectionId: string;
192
+ enforced?: boolean;
193
+ id?: string;
194
+ refId: string;
195
+ scope: 'tenant' | 'user';
196
+ }
197
+ /** A per-user/per-tenant budget-limit override. */
198
+ export interface LtAiBudgetLimit {
199
+ id?: string;
200
+ maxPrompts?: number;
201
+ maxTokens?: number;
202
+ period?: 'day' | 'month' | 'none';
203
+ refId: string;
204
+ scope: 'tenant' | 'user';
205
+ }
206
+ /** An AI interaction audit record. */
207
+ export interface LtAiInteraction {
208
+ actions?: {
209
+ name: string;
210
+ success: boolean;
211
+ }[];
212
+ completionTokens?: number;
213
+ connectionId?: string;
214
+ createdAt?: string;
215
+ id: string;
216
+ iterations?: number;
217
+ prompt?: string;
218
+ promptTokens?: number;
219
+ responseText?: string;
220
+ tenantId?: string;
221
+ totalTokens?: number;
222
+ userId?: string;
223
+ }
224
+ /**
225
+ * An admin-editable AI slot — a logical building block of the SYSTEM prompt
226
+ * (e.g. `base`, `permissions`, `anti_hallucination`, `tool_catalog`).
227
+ * The backend ships built-in defaults for every key; a row here OVERRIDES the
228
+ * default for its `key` (optionally scoped by `locale`/`capability`).
229
+ * When multi-tenancy is active, slots are tenant-scoped.
230
+ */
231
+ export interface LtAiSlot {
232
+ /** Capability scope: 'all', 'native' or 'emulated'. */
233
+ capability?: string;
234
+ /** Slot text (supports {{placeholders}}). */
235
+ content: string;
236
+ createdAt?: string;
237
+ /** Admin-facing description of the slot. */
238
+ description?: string;
239
+ /** Whether the slot is included in the prompt. */
240
+ enabled?: boolean;
241
+ id: string;
242
+ /** Logical prompt slot key (e.g. 'base', 'permissions', 'anti_hallucination'). */
243
+ key: string;
244
+ /** Locale (e.g. 'en', 'de'); empty = all languages. */
245
+ locale?: string;
246
+ /** Assembly order (ascending). */
247
+ order?: number;
248
+ /** Tenant id the slot applies to (auto-set; undefined = system-wide). */
249
+ tenantId?: string;
250
+ updatedAt?: string;
251
+ }
252
+ /** Input to create/update an admin AI slot. */
253
+ export interface LtAiSlotInput {
254
+ capability?: string;
255
+ content?: string;
256
+ description?: string;
257
+ enabled?: boolean;
258
+ key?: string;
259
+ locale?: string;
260
+ order?: number;
261
+ }
262
+ /**
263
+ * Effective slot for the admin UI — framework defaults + tenant overrides +
264
+ * tenant customs in one list. The `isSystem` / `isOverride` flags drive which
265
+ * actions the UI renders:
266
+ * - `isSystem: true` → virtual default row (no `id`). Action: "Bearbeiten" → POST creates an override.
267
+ * - `isOverride: true` → tenant row that overrides a system default. Action: "Zurücksetzen" → reset.
268
+ * - else → custom tenant slot. Action: "Löschen" → real delete (no restore).
269
+ */
270
+ export interface LtAiEffectiveSlot {
271
+ capability?: string;
272
+ content: string;
273
+ description?: string;
274
+ enabled: boolean;
275
+ id?: string;
276
+ /** True when a tenant row overrides a framework default. */
277
+ isOverride: boolean;
278
+ /** True for built-in framework defaults (no DB row). */
279
+ isSystem: boolean;
280
+ key: string;
281
+ locale?: string;
282
+ order: number;
283
+ scope?: string;
284
+ /** System-default key this row overrides (only on overrides). */
285
+ systemKey?: string;
286
+ tenantId?: string;
287
+ }
288
+ /**
289
+ * Public metadata of a registered placeholder — returned by the placeholders
290
+ * endpoint. Used by the slot / prompt editors to render a "what can I insert"
291
+ * hint sidebar dynamically (no hard-coded list in the frontend).
292
+ */
293
+ export interface LtAiPlaceholder {
294
+ /** One-sentence description shown in the helper sidebar. */
295
+ description: string;
296
+ /** Optional example value (tooltip). */
297
+ example?: string;
298
+ /** Token name without curly braces (e.g. `'roles'` matches `{{roles}}`). */
299
+ name: string;
300
+ }
301
+ /**
302
+ * A learned prompt hint from the governed self-improvement loop. Only `approved`
303
+ * + enabled hints reach the prompt; hints only ever ADD guidance and can never
304
+ * relax the backend-enforced security core.
305
+ */
306
+ export interface LtAiPromptHint {
307
+ /** Guidance text added to the prompt when approved. */
308
+ content: string;
309
+ createdAt?: string;
310
+ /** Whether the hint is active. */
311
+ enabled?: boolean;
312
+ id: string;
313
+ /** Number of times the failure pattern was observed. */
314
+ occurrences?: number;
315
+ /** Scope the hint applies to (e.g. a tool name); empty = global. */
316
+ scope?: string;
317
+ /** Governance status: 'suggested', 'approved' or 'rejected'. */
318
+ status?: string;
319
+ /** Failure-pattern identifier that produced the hint. */
320
+ trigger?: string;
321
+ updatedAt?: string;
322
+ }
323
+ /** Input to create/update a learned prompt hint (typically approve/reject or edit). */
324
+ export interface LtAiPromptHintInput {
325
+ content?: string;
326
+ enabled?: boolean;
327
+ occurrences?: number;
328
+ scope?: string;
329
+ status?: string;
330
+ trigger?: string;
331
+ }
332
+ /**
333
+ * A user-facing prompt ("Vorlage") — a short, named piece of text the user
334
+ * can insert into the chat input with one click. Different from
335
+ * {@link LtAiSlot}, which is the admin-only system-prompt building block.
336
+ *
337
+ * Visibility scopes:
338
+ * - `user` — only the owner sees it ("private", default).
339
+ * - `tenant` — all members of the owner's tenant see it ("public").
340
+ */
341
+ export interface LtAiPrompt {
342
+ /** The prompt text inserted into the chat input (may contain placeholders). */
343
+ content: string;
344
+ createdAt?: string;
345
+ /** Optional description. */
346
+ description?: string;
347
+ /** Whether the prompt is active (disabled prompts are hidden). */
348
+ enabled?: boolean;
349
+ /** Optional icon hint (lucide name or single emoji). */
350
+ icon?: string;
351
+ id: string;
352
+ /** Display label shown in the picker. */
353
+ name: string;
354
+ /** Owner user id (set automatically by the server). */
355
+ ownerId?: string;
356
+ /** Sort order in the picker (ascending). */
357
+ order?: number;
358
+ /** Visibility scope (`'user'` | `'tenant'` | `'global'`). */
359
+ scope: string;
360
+ /** Tenant id when `scope === 'tenant'` (set automatically by the server). */
361
+ tenantId?: string;
362
+ updatedAt?: string;
363
+ }
364
+ /**
365
+ * Input to create/update a {@link LtAiPrompt} (user-facing "Vorlage").
366
+ *
367
+ * Distinct from {@link LtAiPromptRunInput} (the payload for `useLtAi.prompt()`).
368
+ * Used by `useLtAiPrompts().create()` / `.update()`.
369
+ */
370
+ export interface LtAiPromptInput {
371
+ content?: string;
372
+ description?: string;
373
+ enabled?: boolean;
374
+ icon?: string;
375
+ name?: string;
376
+ order?: number;
377
+ scope?: string;
378
+ }
379
+ export interface UseLtAiReturn {
380
+ error: DeepReadonly<Ref<null | string>>;
381
+ loading: DeepReadonly<Ref<boolean>>;
382
+ prompt: (input: LtAiPromptRunInput) => Promise<LtAiResponse>;
383
+ promptStream: (input: LtAiPromptRunInput, handlers?: LtAiStreamHandlers, options?: {
384
+ signal?: AbortSignal;
385
+ }) => Promise<LtAiResponse | undefined>;
386
+ streaming: DeepReadonly<Ref<boolean>>;
387
+ }
388
+ export interface UseLtAiChatOptions {
389
+ /** Fixed connection id (or a ref) to use for every turn. */
390
+ connectionId?: Ref<string | undefined> | string;
391
+ /** Existing conversation id to continue. */
392
+ conversationId?: string;
393
+ /**
394
+ * Cap the local `messages` array. When the cap is exceeded after a new push,
395
+ * the oldest entries are removed. Use this for long-running chats to prevent
396
+ * unbounded memory growth. Server-side conversation history is unaffected.
397
+ */
398
+ maxMessages?: number;
399
+ /** Producer for per-turn client metadata (e.g. current URL). */
400
+ metadata?: () => Record<string, unknown>;
401
+ /** Execution mode for every turn. */
402
+ mode?: LtAiMode;
403
+ /** Whether to stream responses (default true). */
404
+ stream?: boolean;
405
+ }
406
+ export interface UseLtAiChatReturn {
407
+ budget: DeepReadonly<Ref<LtAiBudgetSummary | null>>;
408
+ clear: () => void;
409
+ confirm: () => Promise<void>;
410
+ /** Context-window utilization of the latest assistant turn (used/total tokens). */
411
+ contextWindow: DeepReadonly<Ref<{
412
+ total: number;
413
+ used: number;
414
+ } | null>>;
415
+ conversationId: DeepReadonly<Ref<string | undefined>>;
416
+ error: DeepReadonly<Ref<null | string>>;
417
+ messages: Readonly<Ref<LtAiMessage[]>>;
418
+ requiresConfirmation: ComputedRef<boolean>;
419
+ send: (content: string) => Promise<void>;
420
+ stop: () => void;
421
+ streaming: DeepReadonly<Ref<boolean>>;
422
+ }
423
+ export interface UseLtAiConnectionsReturn {
424
+ connections: DeepReadonly<Ref<LtAiAvailableConnection[]>>;
425
+ error: DeepReadonly<Ref<null | string>>;
426
+ loading: DeepReadonly<Ref<boolean>>;
427
+ load: () => Promise<void>;
428
+ locked: ComputedRef<boolean>;
429
+ select: (connectionId: string) => Promise<void>;
430
+ selected: ComputedRef<LtAiAvailableConnection | undefined>;
431
+ }
432
+ export interface UseLtAiUsageReturn {
433
+ error: DeepReadonly<Ref<null | string>>;
434
+ loading: DeepReadonly<Ref<boolean>>;
435
+ load: () => Promise<void>;
436
+ usage: DeepReadonly<Ref<LtAiUsageInfo | null>>;
437
+ }
438
+ /**
439
+ * User-facing prompt composable. Lets any signed-in user manage their own
440
+ * prompts ("Vorlagen") and use the visible ones (own private + tenant public)
441
+ * in a chat.
442
+ */
443
+ export interface UseLtAiPromptsReturn {
444
+ create: (input: LtAiPromptInput) => Promise<LtAiPrompt>;
445
+ error: DeepReadonly<Ref<null | string>>;
446
+ load: () => Promise<void>;
447
+ loading: DeepReadonly<Ref<boolean>>;
448
+ prompts: DeepReadonly<Ref<LtAiPrompt[]>>;
449
+ remove: (id: string) => Promise<LtAiPrompt>;
450
+ update: (id: string, input: LtAiPromptInput) => Promise<LtAiPrompt>;
451
+ }
452
+ /**
453
+ * Admin AI composable surface — headless on purpose: every method returns the
454
+ * raw backend response. No shared `loading` / `error` refs because admin
455
+ * screens typically need per-row spinners and per-action toasts that a single
456
+ * shared ref cannot model. Wire each call to your UI layer's loading/error
457
+ * scheme.
458
+ *
459
+ * All endpoints are server-side `@Restricted(ADMIN)`; the composable itself
460
+ * does not enforce role. Render admin UI behind a frontend route guard for UX,
461
+ * but trust the backend for authorization.
462
+ */
463
+ export interface UseLtAiAdminReturn {
464
+ /** Create a per-user/per-tenant budget limit override (POST /ai/budget-limits). */
465
+ createBudgetLimit: (input: LtAiBudgetLimit) => Promise<LtAiBudgetLimit>;
466
+ /** Create a connection. `input.apiKey` is write-only; the response never echoes it. */
467
+ createConnection: (input: LtAiConnectionInput) => Promise<LtAiConnection>;
468
+ /** Create a learned prompt hint (typically used to manually approve/reject). */
469
+ createPromptHint: (input: LtAiPromptHintInput) => Promise<LtAiPromptHint>;
470
+ /** Create a tenant-scoped system-prompt slot row (overrides framework default for `key`). */
471
+ createSlot: (input: LtAiSlotInput) => Promise<LtAiSlot>;
472
+ deleteBudgetLimit: (id: string) => Promise<LtAiBudgetLimit>;
473
+ deleteConnection: (id: string) => Promise<LtAiConnection>;
474
+ /** Delete a connection preference by its preference id (NOT the user/tenant id). */
475
+ deletePreference: (id: string) => Promise<LtAiConnectionPreference>;
476
+ deletePromptHint: (id: string) => Promise<LtAiPromptHint>;
477
+ deleteSlot: (id: string) => Promise<LtAiSlot>;
478
+ /**
479
+ * Re-detect a connection's `capabilities` / `supportsNativeTools` / `supportsVision`
480
+ * by probing the provider. Mutates the persisted connection row.
481
+ */
482
+ detectCapabilities: (id: string) => Promise<LtAiConnection>;
483
+ /** Returns the connection WITHOUT the `apiKey` (only `hasApiKey: boolean`). */
484
+ getConnection: (id: string) => Promise<LtAiConnection>;
485
+ listBudgetLimits: () => Promise<LtAiBudgetLimit[]>;
486
+ listConnections: () => Promise<LtAiConnection[]>;
487
+ /** Effective slots view — framework defaults overlaid by tenant overrides + tenant customs. */
488
+ listEffectiveSlots: () => Promise<LtAiEffectiveSlot[]>;
489
+ /** Recent AI interactions (audit log, ADMIN-only). */
490
+ listInteractions: () => Promise<LtAiInteraction[]>;
491
+ listPreferences: () => Promise<LtAiConnectionPreference[]>;
492
+ listPromptHints: () => Promise<LtAiPromptHint[]>;
493
+ /** List ONLY tenant overrides + customs (not the framework defaults — use `listEffectiveSlots` for that). */
494
+ listSlots: () => Promise<LtAiSlot[]>;
495
+ /** Reset a tenant override → framework default applies again. */
496
+ resetSlot: (id: string) => Promise<boolean>;
497
+ /**
498
+ * Upsert a connection preference for the given `refId` (user or tenant) +
499
+ * `scope`. Replaces the existing row for that scope if present.
500
+ */
501
+ setPreference: (input: LtAiConnectionPreference) => Promise<LtAiConnectionPreference>;
502
+ updateBudgetLimit: (id: string, input: LtAiBudgetLimit) => Promise<LtAiBudgetLimit>;
503
+ /**
504
+ * Update a connection. `input.apiKey`: pass the new value to set, an empty
505
+ * string `''` to clear, omit to leave the stored key unchanged.
506
+ */
507
+ updateConnection: (id: string, input: LtAiConnectionInput) => Promise<LtAiConnection>;
508
+ updatePromptHint: (id: string, input: LtAiPromptHintInput) => Promise<LtAiPromptHint>;
509
+ updateSlot: (id: string, input: LtAiSlotInput) => Promise<LtAiSlot>;
510
+ }
511
+ /**
512
+ * Placeholder list composable. Loads the runtime placeholder registry from
513
+ * the backend (`GET /ai/placeholders`) so slot / prompt editors can render
514
+ * a dynamic helper sidebar without hard-coding any names in the frontend.
515
+ */
516
+ export interface UseLtAiPlaceholdersReturn {
517
+ error: DeepReadonly<Ref<null | string>>;
518
+ load: () => Promise<void>;
519
+ loading: DeepReadonly<Ref<boolean>>;
520
+ placeholders: DeepReadonly<Ref<LtAiPlaceholder[]>>;
521
+ }
File without changes
@@ -1,4 +1,5 @@
1
1
  export type { LtAuthClientConfig, LtAuthMode, LtAuthResponse, LtAuthState, LtPasskeyAuthResult, LtPasskeyRegisterResult, LtUser, UseLtAuthReturn } from './auth.js';
2
2
  export type { LtFileInfo, LtUploadItem, LtUploadOptions, LtUploadProgress, LtUploadStatus, UseLtFileReturn, UseLtTusUploadReturn } from './upload.js';
3
- export type { LtAuthCookieNamesOptions, LtAuthModuleOptions, LtErrorTranslationModuleOptions, LtExtensionsModuleOptions, LtExtensionsPublicRuntimeConfig, LtI18nModuleOptions, LtSystemSetupModuleOptions, LtTusModuleOptions, } from './module.js';
3
+ export type { LtAiModuleOptions, LtAuthCookieNamesOptions, LtAuthModuleOptions, LtErrorTranslationModuleOptions, LtExtensionsModuleOptions, LtExtensionsPublicRuntimeConfig, LtI18nModuleOptions, LtSystemSetupModuleOptions, LtTusModuleOptions, } from './module.js';
4
4
  export type { LtErrorTranslationResponse, LtParsedError, UseLtErrorTranslationReturn } from './error.js';
5
+ export type { LtAiAction, LtAiAvailableConnection, LtAiBudgetLimit, LtAiBudgetSummary, LtAiConnection, LtAiConnectionInput, LtAiConnectionPreference, LtAiEffectiveSlot, LtAiInteraction, LtAiMessage, LtAiMode, LtAiPlaceholder, LtAiPrompt, LtAiPromptHint, LtAiPromptHintInput, LtAiPromptInput, LtAiPromptRunInput, LtAiResponse, LtAiSlot, LtAiSlotInput, LtAiStreamEvent, LtAiStreamHandlers, LtAiUsage, LtAiUsageInfo, LtAiUsageScope, UseLtAiAdminReturn, UseLtAiChatOptions, UseLtAiChatReturn, UseLtAiConnectionsReturn, UseLtAiPlaceholdersReturn, UseLtAiPromptsReturn, UseLtAiReturn, UseLtAiUsageReturn, } from './ai.js';
@@ -107,10 +107,22 @@ export interface LtErrorTranslationModuleOptions {
107
107
  /** Default locale if not detected (default: 'de') */
108
108
  defaultLocale?: string;
109
109
  }
110
+ /**
111
+ * AI module configuration options (client side). Mirrors the nest-server AI
112
+ * module's REST base path so the composables hit the right endpoints.
113
+ */
114
+ export interface LtAiModuleOptions {
115
+ /** AI API base path (default: '/ai' — must match the nest-server AI controller). */
116
+ basePath?: string;
117
+ /** Enable the AI composables/auto-imports (default: true). */
118
+ enabled?: boolean;
119
+ }
110
120
  /**
111
121
  * Main module options for @lenne.tech/nuxt-extensions
112
122
  */
113
123
  export interface LtExtensionsModuleOptions {
124
+ /** AI module configuration */
125
+ ai?: LtAiModuleOptions;
114
126
  /** Auth module configuration */
115
127
  auth?: LtAuthModuleOptions;
116
128
  /** Error translation configuration */
@@ -125,6 +137,10 @@ export interface LtExtensionsModuleOptions {
125
137
  */
126
138
  export interface LtExtensionsPublicRuntimeConfig {
127
139
  ltExtensions: {
140
+ ai: {
141
+ basePath: string;
142
+ enabled: boolean;
143
+ };
128
144
  auth: {
129
145
  basePath: string;
130
146
  baseURL: string;
package/dist/types.d.mts CHANGED
@@ -4,12 +4,6 @@ import type { default as Module } from './module.mjs'
4
4
 
5
5
  export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
6
 
7
- export { type LtAuthClientConfig, type LtAuthMode, type LtAuthResponse, type LtAuthState, type LtPasskeyAuthResult, type LtPasskeyRegisterResult, type LtUser, type UseLtAuthReturn } from '../dist/runtime/types/auth.js'
8
-
9
- export { type LtFileInfo, type LtUploadItem, type LtUploadOptions, type LtUploadProgress, type LtUploadStatus, type UseLtFileReturn, type UseLtTusUploadReturn } from '../dist/runtime/types/upload.js'
10
-
11
- export { type LtAuthCookieNamesOptions, type LtAuthModuleOptions, type LtErrorTranslationModuleOptions, type LtExtensionsModuleOptions, type LtExtensionsPublicRuntimeConfig, type LtI18nModuleOptions, type LtSystemSetupModuleOptions, type LtTusModuleOptions } from '../dist/runtime/types/module.js'
12
-
13
- export { type LtErrorTranslationResponse, type LtParsedError, type UseLtErrorTranslationReturn } from '../dist/runtime/types/error.js'
14
-
15
7
  export { type DEFAULT_LT_AUTH_STATE_COOKIE, type DEFAULT_LT_JWT_TOKEN_COOKIE, type configKey, default, type name, type version } from './module.mjs'
8
+
9
+ export * from '../dist/runtime/types/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nuxt-extensions",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,6 +14,7 @@
14
14
  "license": "MIT",
15
15
  "packageManager": "pnpm@10.33.0",
16
16
  "type": "module",
17
+ "sideEffects": false,
17
18
  "exports": {
18
19
  ".": {
19
20
  "types": "./dist/types.d.mts",
@@ -70,7 +71,7 @@
70
71
  "release": "pnpm format:check && pnpm lint && pnpm test:types && pnpm test && pnpm prepack"
71
72
  },
72
73
  "dependencies": {
73
- "@nuxt/kit": "4.4.4"
74
+ "@nuxt/kit": "4.4.6"
74
75
  },
75
76
  "peerDependencies": {
76
77
  "@better-auth/passkey": ">=1.0.0",
@@ -94,28 +95,34 @@
94
95
  }
95
96
  },
96
97
  "devDependencies": {
97
- "@better-auth/passkey": "1.6.10",
98
+ "@better-auth/passkey": "1.6.13",
98
99
  "@nuxt/devtools": "3.2.4",
99
100
  "@nuxt/module-builder": "1.0.2",
100
- "@nuxt/schema": "4.4.4",
101
- "@playwright/test": "1.59.1",
102
- "@types/node": "25.6.2",
103
- "@vitest/coverage-v8": "4.1.5",
104
- "better-auth": "1.6.10",
101
+ "@nuxt/schema": "4.4.6",
102
+ "@playwright/test": "1.60.0",
103
+ "@types/node": "25.9.1",
104
+ "@vitest/coverage-v8": "4.1.7",
105
+ "better-auth": "1.6.13",
105
106
  "happy-dom": "20.9.0",
106
- "nuxt": "4.4.4",
107
- "oxfmt": "0.48.0",
108
- "oxlint": "1.63.0",
107
+ "nuxt": "4.4.6",
108
+ "oxfmt": "0.52.0",
109
+ "oxlint": "1.67.0",
109
110
  "tus-js-client": "4.3.1",
110
111
  "typescript": "5.9.3",
111
- "vitest": "4.1.5",
112
- "vue-tsc": "3.2.8"
112
+ "vitest": "4.1.7",
113
+ "vue-tsc": "3.3.3"
113
114
  },
114
115
  "pnpm": {
115
116
  "onlyBuiltDependencies": [
116
117
  "@parcel/watcher",
117
118
  "esbuild"
118
- ]
119
+ ],
120
+ "overrides": {
121
+ "brace-expansion@>=5.0.0 <5.0.6": "5.0.6",
122
+ "devalue@>=5.6.3 <=5.8.0": "5.8.1",
123
+ "kysely@>=0.26.0 <0.28.17": "0.28.17",
124
+ "ws@>=8.0.0 <8.20.1": "8.21.0"
125
+ }
119
126
  },
120
127
  "keywords": [
121
128
  "nuxt",