@lenne.tech/nuxt-extensions 1.26.0 → 1.27.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/CLAUDE.md CHANGED
@@ -43,7 +43,7 @@ src/
43
43
  | `useLtAiSettings()` | The user's own AI settings: MCP confirmation switch (`GET/PUT /ai/settings`, `enforced` → show disabled) |
44
44
  | `useLtAiStatus()` | Whether the API's AI module is on (`GET /ai/status`, public; 404 = off): `enabled`, `mcp`, shared `useState`, one request per app start, fails closed |
45
45
  | `useLtAiUsage()` | Full token/prompt usage breakdown (`GET /ai/usage`) |
46
- | `useLtAiPrompts()` | User-facing CRUD for re-usable prompt snippets ("Vorlagen", `scope: 'user'` / `'tenant'`) |
46
+ | `useLtAiPrompts()` | User-facing CRUD for re-usable prompt snippets ("Vorlagen", `scope: 'user'` / `'tenant'`). `load()` = active only (chat picker); `load({ includeDisabled: true })` = management list (nest-server >= 12.7.0), kept for the reload after create/update/remove |
47
47
  | `useLtAiPlaceholders()` | Loads the backend's `{{placeholder}}` registry for editor sidebars |
48
48
  | `useLtAiAdmin()` | Admin CRUD: connections, preferences, budget limits, slots, prompt hints, interactions — server-gated |
49
49
 
package/README.md CHANGED
@@ -866,6 +866,21 @@ await load();
866
866
  is private to the owner; `scope: 'tenant'` is shared across the owner's tenant. The list
867
867
  returned by `load()` is already server-filtered to what the user is allowed to see.
868
868
 
869
+ `load()` lists active prompts only, which is what a chat picker offers. A management screen
870
+ calls `load({ includeDisabled: true })` (nest-server >= 12.7.0), so a prompt saved with
871
+ `enabled: false` stays in the list and can be switched on again:
872
+
873
+ ```typescript
874
+ // Settings page: every prompt, disabled ones included
875
+ const { load, prompts, update } = useLtAiPrompts();
876
+ onMounted(() => load({ includeDisabled: true }));
877
+ // The reload after create / update / remove asks for the same list
878
+ await update(prompt.id, { enabled: false });
879
+ ```
880
+
881
+ Each `useLtAiPrompts()` call has its own list, so the chat picker on the same page stays on
882
+ active prompts. An API before 12.7.0 ignores the parameter and lists active prompts only.
883
+
869
884
  ### AI status
870
885
 
871
886
  `useLtAiStatus()` says whether the API's AI module is on, so AI pages and navigation entries can
package/dist/module.d.mts CHANGED
@@ -3,7 +3,7 @@ import { LtExtensionsModuleOptions } from '../dist/runtime/types/index.js';
3
3
  export * from '../dist/runtime/types/index.js';
4
4
 
5
5
  declare const name = "@lenne.tech/nuxt-extensions";
6
- declare const version = "1.26.0";
6
+ declare const version = "1.27.0";
7
7
  declare const configKey = "ltExtensions";
8
8
  declare const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
9
9
  declare const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "configKey": "ltExtensions",
3
3
  "name": "@lenne.tech/nuxt-extensions",
4
- "version": "1.26.0",
4
+ "version": "1.27.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
3
3
  import { SECURITY_TXT_DEFAULT_VALID_DAYS, SECURITY_TXT_DEFAULT_LANGUAGES, SECURITY_TXT_DEFAULT_CONTACT, SECURITY_TXT_PATH } from '../dist/runtime/server/lib/security-txt.js';
4
4
 
5
5
  const name = "@lenne.tech/nuxt-extensions";
6
- const version = "1.26.0";
6
+ const version = "1.27.0";
7
7
  const configKey = "ltExtensions";
8
8
  const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
9
9
  const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Any signed-in user can author re-usable prompts ("Vorlagen") for themselves
5
5
  * (`scope: 'user'` = private) or for their tenant (`scope: 'tenant'` = public).
6
- * `load()` returns every prompt the current user is allowed to see (own +
7
- * tenant), already filtered by the server.
6
+ * `load()` returns every active prompt the current user is allowed to see (own +
7
+ * tenant), already filtered by the server. That is what a chat picker offers.
8
+ * A management screen calls `load({ includeDisabled: true })` (nest-server >= 12.7.0),
9
+ * so a prompt switched off stays in the list and can be switched on again.
8
10
  *
9
11
  * Pair this with your own prompt picker / settings UI. The nuxt-base-starter
10
12
  * ships a reference picker inside the AI chat and a settings page.
@@ -4,11 +4,17 @@ export function useLtAiPrompts() {
4
4
  const prompts = ref([]);
5
5
  const loading = ref(false);
6
6
  const error = ref(null);
7
- async function load() {
7
+ let includeDisabled = false;
8
+ async function load(options) {
9
+ includeDisabled = options?.includeDisabled === true;
10
+ await fetchPrompts();
11
+ }
12
+ async function fetchPrompts() {
8
13
  loading.value = true;
9
14
  error.value = null;
10
15
  try {
11
- prompts.value = await ltAiRequest("GET", "/prompts") || [];
16
+ const path = includeDisabled ? "/prompts?includeDisabled=true" : "/prompts";
17
+ prompts.value = await ltAiRequest("GET", path) || [];
12
18
  } catch (err) {
13
19
  error.value = err.message;
14
20
  prompts.value = [];
@@ -21,7 +27,7 @@ export function useLtAiPrompts() {
21
27
  error.value = null;
22
28
  try {
23
29
  const created = await ltAiRequest("POST", "/prompts", input);
24
- await load();
30
+ await fetchPrompts();
25
31
  return created;
26
32
  } catch (err) {
27
33
  error.value = err.message;
@@ -35,7 +41,7 @@ export function useLtAiPrompts() {
35
41
  error.value = null;
36
42
  try {
37
43
  const updated = await ltAiRequest("PUT", `/prompts/${encodeURIComponent(id)}`, input);
38
- await load();
44
+ await fetchPrompts();
39
45
  return updated;
40
46
  } catch (err) {
41
47
  error.value = err.message;
@@ -49,7 +55,7 @@ export function useLtAiPrompts() {
49
55
  error.value = null;
50
56
  try {
51
57
  const removed = await ltAiRequest("DELETE", `/prompts/${encodeURIComponent(id)}`);
52
- await load();
58
+ await fetchPrompts();
53
59
  return removed;
54
60
  } catch (err) {
55
61
  error.value = err.message;
@@ -366,7 +366,10 @@ export interface LtAiPrompt {
366
366
  createdAt?: string;
367
367
  /** Optional description. */
368
368
  description?: string;
369
- /** Whether the prompt is active (disabled prompts are hidden). */
369
+ /**
370
+ * Whether the prompt is active. The server lists disabled prompts only on request
371
+ * (`useLtAiPrompts().load({ includeDisabled: true })`, nest-server >= 12.7.0).
372
+ */
370
373
  enabled?: boolean;
371
374
  /** Optional icon hint (lucide name or single emoji). */
372
375
  icon?: string;
@@ -477,6 +480,18 @@ export interface UseLtAiUsageReturn {
477
480
  load: () => Promise<void>;
478
481
  usage: DeepReadonly<Ref<LtAiUsageInfo | null>>;
479
482
  }
483
+ /**
484
+ * Options of `useLtAiPrompts().load()`.
485
+ */
486
+ export interface LtAiPromptsLoadOptions {
487
+ /**
488
+ * Also list disabled prompts (`GET /ai/prompts?includeDisabled=true`, nest-server >= 12.7.0).
489
+ * For a management screen, where a disabled prompt must stay editable. A chat picker leaves it
490
+ * off, because it must offer active prompts only. A server before 12.7.0 ignores the parameter
491
+ * and lists active prompts only.
492
+ */
493
+ includeDisabled?: boolean;
494
+ }
480
495
  /**
481
496
  * User-facing prompt composable. Lets any signed-in user manage their own
482
497
  * prompts ("Vorlagen") and use the visible ones (own private + tenant public)
@@ -485,7 +500,11 @@ export interface UseLtAiUsageReturn {
485
500
  export interface UseLtAiPromptsReturn {
486
501
  create: (input: LtAiPromptInput) => Promise<LtAiPrompt>;
487
502
  error: DeepReadonly<Ref<null | string>>;
488
- load: () => Promise<void>;
503
+ /**
504
+ * Loads the prompts the user may see. Its options also apply to the reload after `create`,
505
+ * `update` and `remove`, so a prompt saved as disabled stays in a management list.
506
+ */
507
+ load: (options?: LtAiPromptsLoadOptions) => Promise<void>;
489
508
  loading: DeepReadonly<Ref<boolean>>;
490
509
  prompts: DeepReadonly<Ref<LtAiPrompt[]>>;
491
510
  remove: (id: string) => Promise<LtAiPrompt>;
@@ -3,4 +3,4 @@ export type { LtFileInfo, LtUploadItem, LtUploadOptions, LtUploadProgress, LtUpl
3
3
  export type { LtAiModuleOptions, LtAuthCookieNamesOptions, LtAuthModuleOptions, LtErrorTranslationModuleOptions, LtExtensionsModuleOptions, LtExtensionsPublicRuntimeConfig, LtFormLabelAssociationOptions, LtI18nModuleOptions, LtPreHydrationInputOptions, LtSecurityTxtOptions, LtSystemSetupModuleOptions, LtTusModuleOptions, } from './module.js';
4
4
  export type { LtErrorTranslationResponse, LtParsedError, UseLtErrorTranslationReturn } from './error.js';
5
5
  export type { LtSyncConflict, LtSyncConflictResolution, LtSyncIdFormat, LtSyncItemStatus, LtSyncModuleOptions, LtSyncPushResult, LtSyncRecord, LtSyncResult, UseLtOfflineSyncOptions, UseLtOfflineSyncReturn, } from './sync.js';
6
- export type { LtAiAction, LtAiAvailableConnection, LtAiBudgetLimit, LtAiBudgetSummary, LtAiConnection, LtAiConnectionInput, LtAiConnectionPreference, LtAiEffectiveSlot, LtAiInteraction, LtAiMessage, LtAiMode, LtAiPlaceholder, LtAiPrompt, LtAiPromptHint, LtAiPromptHintInput, LtAiPromptInput, LtAiPromptRunInput, LtAiResponse, LtAiSettings, LtAiSettingsInput, LtAiSlot, LtAiStatus, LtAiSlotInput, LtAiStreamEvent, LtAiStreamHandlers, LtAiUsage, LtAiUsageInfo, LtAiUsageScope, UseLtAiAdminReturn, UseLtAiChatOptions, UseLtAiChatReturn, UseLtAiConnectionsReturn, UseLtAiPlaceholdersReturn, UseLtAiPromptsReturn, UseLtAiReturn, UseLtAiSettingsReturn, UseLtAiStatusReturn, UseLtAiUsageReturn, } from './ai.js';
6
+ export type { LtAiAction, LtAiAvailableConnection, LtAiBudgetLimit, LtAiBudgetSummary, LtAiConnection, LtAiConnectionInput, LtAiConnectionPreference, LtAiEffectiveSlot, LtAiInteraction, LtAiMessage, LtAiMode, LtAiPlaceholder, LtAiPrompt, LtAiPromptHint, LtAiPromptHintInput, LtAiPromptInput, LtAiPromptRunInput, LtAiPromptsLoadOptions, LtAiResponse, LtAiSettings, LtAiSettingsInput, LtAiSlot, LtAiStatus, LtAiSlotInput, LtAiStreamEvent, LtAiStreamHandlers, LtAiUsage, LtAiUsageInfo, LtAiUsageScope, UseLtAiAdminReturn, UseLtAiChatOptions, UseLtAiChatReturn, UseLtAiConnectionsReturn, UseLtAiPlaceholdersReturn, UseLtAiPromptsReturn, UseLtAiReturn, UseLtAiSettingsReturn, UseLtAiStatusReturn, UseLtAiUsageReturn, } from './ai.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nuxt-extensions",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
5
5
  "repository": {
6
6
  "type": "git",