@btst/stack 4.1.0 → 4.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.
Files changed (82) hide show
  1. package/README.md +2 -2
  2. package/dist/packages/stack/src/plugins/ai-chat/api/operations.cjs +15 -9
  3. package/dist/packages/stack/src/plugins/ai-chat/api/operations.mjs +16 -10
  4. package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.cjs +28 -0
  5. package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.mjs +29 -2
  6. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +5 -0
  7. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +5 -0
  8. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.cjs +91 -8
  9. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.mjs +91 -8
  10. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.cjs +76 -3
  11. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.mjs +80 -7
  12. package/dist/packages/stack/src/plugins/ai-chat/client/components/tool-call-display.cjs +17 -0
  13. package/dist/packages/stack/src/plugins/ai-chat/client/components/tool-call-display.mjs +18 -1
  14. package/dist/packages/stack/src/plugins/ai-chat/client/context/chat-analytics.cjs +42 -0
  15. package/dist/packages/stack/src/plugins/ai-chat/client/context/chat-analytics.mjs +39 -0
  16. package/dist/packages/stack/src/plugins/ai-chat/client/plugin.cjs +2 -1
  17. package/dist/packages/stack/src/plugins/ai-chat/client/plugin.mjs +2 -1
  18. package/dist/plugins/ai-chat/api/index.d.cts +2 -2
  19. package/dist/plugins/ai-chat/api/index.d.mts +2 -2
  20. package/dist/plugins/ai-chat/api/index.d.ts +2 -2
  21. package/dist/plugins/ai-chat/client/components/index.d.cts +2 -1
  22. package/dist/plugins/ai-chat/client/components/index.d.mts +2 -1
  23. package/dist/plugins/ai-chat/client/components/index.d.ts +2 -1
  24. package/dist/plugins/ai-chat/client/context/page-ai-context.cjs +4 -0
  25. package/dist/plugins/ai-chat/client/context/page-ai-context.d.cts +6 -2
  26. package/dist/plugins/ai-chat/client/context/page-ai-context.d.mts +6 -2
  27. package/dist/plugins/ai-chat/client/context/page-ai-context.d.ts +6 -2
  28. package/dist/plugins/ai-chat/client/context/page-ai-context.mjs +4 -1
  29. package/dist/plugins/ai-chat/client/hooks/index.d.cts +2 -2
  30. package/dist/plugins/ai-chat/client/hooks/index.d.mts +2 -2
  31. package/dist/plugins/ai-chat/client/hooks/index.d.ts +2 -2
  32. package/dist/plugins/ai-chat/client/index.d.cts +7 -3
  33. package/dist/plugins/ai-chat/client/index.d.mts +7 -3
  34. package/dist/plugins/ai-chat/client/index.d.ts +7 -3
  35. package/dist/plugins/ai-chat/query-keys.d.cts +1 -1
  36. package/dist/plugins/ai-chat/query-keys.d.mts +1 -1
  37. package/dist/plugins/ai-chat/query-keys.d.ts +1 -1
  38. package/dist/plugins/blog/api/index.d.cts +2 -2
  39. package/dist/plugins/blog/api/index.d.mts +2 -2
  40. package/dist/plugins/blog/api/index.d.ts +2 -2
  41. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  42. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  43. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  44. package/dist/plugins/blog/client/index.d.cts +2 -2
  45. package/dist/plugins/blog/client/index.d.mts +2 -2
  46. package/dist/plugins/blog/client/index.d.ts +2 -2
  47. package/dist/plugins/blog/query-keys.d.cts +2 -2
  48. package/dist/plugins/blog/query-keys.d.mts +2 -2
  49. package/dist/plugins/blog/query-keys.d.ts +2 -2
  50. package/dist/shared/{stack.CjCSDfWy.d.mts → stack.94kN3pEK.d.mts} +5 -5
  51. package/dist/shared/{stack.B5yPgHsp.d.mts → stack.B7Mj74BQ.d.mts} +18 -2
  52. package/dist/shared/{stack.BGzgFx3R.d.cts → stack.BTStHVTy.d.cts} +5 -5
  53. package/dist/shared/{stack.rVF0f509.d.mts → stack.C-eQN_Jt.d.ts} +60 -4
  54. package/dist/shared/{stack.rVF0f509.d.ts → stack.C5FZr-jJ.d.mts} +60 -4
  55. package/dist/shared/{stack.Dvy7FmaA.d.mts → stack.CTneIW0u.d.mts} +37 -37
  56. package/dist/shared/{stack.BOZRaVpu.d.cts → stack.Ce6V7eDj.d.cts} +37 -37
  57. package/dist/shared/{stack.DlBoNqYu.d.ts → stack.D5b9l24t.d.ts} +37 -37
  58. package/dist/shared/{stack.3Sr6qRtT.d.ts → stack.DBH1Bjko.d.ts} +18 -2
  59. package/dist/shared/{stack.Dpg_JjIo.d.ts → stack.DfrRYOIl.d.ts} +5 -5
  60. package/dist/shared/{stack.C4oVW2qK.d.cts → stack.Dgt3MCtW.d.cts} +18 -2
  61. package/dist/shared/{stack.rVF0f509.d.cts → stack.xAiy2VtO.d.cts} +60 -4
  62. package/package.json +1 -1
  63. package/src/plugins/ai-chat/__tests__/authorization.test.ts +106 -1
  64. package/src/plugins/ai-chat/__tests__/classnames-overrides.test.tsx +4 -1
  65. package/src/plugins/ai-chat/__tests__/page-content.test.ts +177 -0
  66. package/src/plugins/ai-chat/__tests__/page-widget.test.tsx +573 -0
  67. package/src/plugins/ai-chat/api/operations.ts +29 -13
  68. package/src/plugins/ai-chat/api/page-tools.ts +56 -2
  69. package/src/plugins/ai-chat/api/plugin.ts +13 -0
  70. package/src/plugins/ai-chat/client/analytics.ts +35 -0
  71. package/src/plugins/ai-chat/client/components/chat-interface.tsx +113 -10
  72. package/src/plugins/ai-chat/client/components/chat-layout.tsx +118 -7
  73. package/src/plugins/ai-chat/client/components/tool-call-display.tsx +29 -1
  74. package/src/plugins/ai-chat/client/context/chat-analytics.tsx +46 -0
  75. package/src/plugins/ai-chat/client/context/page-ai-context.tsx +9 -1
  76. package/src/plugins/ai-chat/client/index.ts +2 -0
  77. package/src/plugins/ai-chat/client/localization/index.ts +8 -0
  78. package/src/plugins/ai-chat/client/overrides.ts +5 -0
  79. package/src/plugins/ai-chat/client/plugin.tsx +3 -0
  80. package/dist/shared/{stack.Csi-4Mgz.d.cts → stack.CKc_Bais.d.cts} +7 -7
  81. package/dist/shared/{stack.Csi-4Mgz.d.mts → stack.CKc_Bais.d.mts} +7 -7
  82. package/dist/shared/{stack.Csi-4Mgz.d.ts → stack.CKc_Bais.d.ts} +7 -7
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
3
  import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.Csi-4Mgz.cjs';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.CKc_Bais.cjs';
6
6
  import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.cjs';
7
7
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
8
8
  import { DeepReadonly, OperationContext, OperationErrorContext } from '@btst/stack/plugins/api';
@@ -89,6 +89,12 @@ declare const NextPreviousPostsQuerySchema: z.ZodObject<{
89
89
  date: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
90
90
  }, z.core.$strip>;
91
91
  declare const CreatePostOperationInputSchema: z.ZodObject<{
92
+ slug: z.ZodOptional<z.ZodString>;
93
+ title: z.ZodString;
94
+ content: z.ZodString;
95
+ excerpt: z.ZodString;
96
+ image: z.ZodOptional<z.ZodString>;
97
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
92
98
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
93
99
  name: z.ZodString;
94
100
  }, z.core.$strip>, z.ZodObject<{
@@ -96,12 +102,6 @@ declare const CreatePostOperationInputSchema: z.ZodObject<{
96
102
  name: z.ZodString;
97
103
  slug: z.ZodString;
98
104
  }, z.core.$strip>]>>>>;
99
- slug: z.ZodOptional<z.ZodString>;
100
- title: z.ZodString;
101
- content: z.ZodString;
102
- excerpt: z.ZodString;
103
- image: z.ZodOptional<z.ZodString>;
104
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
105
105
  publishedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
106
106
  createdAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
107
107
  updatedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
@@ -109,6 +109,12 @@ declare const CreatePostOperationInputSchema: z.ZodObject<{
109
109
  declare const UpdatePostOperationInputSchema: z.ZodObject<{
110
110
  id: z.ZodString;
111
111
  data: z.ZodObject<{
112
+ slug: z.ZodString;
113
+ title: z.ZodString;
114
+ content: z.ZodString;
115
+ excerpt: z.ZodString;
116
+ image: z.ZodOptional<z.ZodString>;
117
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
118
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
113
119
  name: z.ZodString;
114
120
  }, z.core.$strip>, z.ZodObject<{
@@ -116,12 +122,6 @@ declare const UpdatePostOperationInputSchema: z.ZodObject<{
116
122
  name: z.ZodString;
117
123
  slug: z.ZodString;
118
124
  }, z.core.$strip>]>>>>;
119
- slug: z.ZodString;
120
- title: z.ZodString;
121
- content: z.ZodString;
122
- excerpt: z.ZodString;
123
- image: z.ZodOptional<z.ZodString>;
124
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
125
125
  publishedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
126
126
  createdAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
127
127
  updatedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
@@ -386,6 +386,9 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
386
386
  title: string;
387
387
  content: string;
388
388
  excerpt: string;
389
+ slug?: string | undefined;
390
+ image?: string | undefined;
391
+ published?: boolean | undefined;
389
392
  tags?: ({
390
393
  name: string;
391
394
  } | {
@@ -393,9 +396,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
393
396
  name: string;
394
397
  slug: string;
395
398
  })[] | undefined;
396
- slug?: string | undefined;
397
- image?: string | undefined;
398
- published?: boolean | undefined;
399
399
  publishedAt?: unknown;
400
400
  createdAt?: unknown;
401
401
  updatedAt?: unknown;
@@ -403,6 +403,9 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
403
403
  title: string;
404
404
  content: string;
405
405
  excerpt: string;
406
+ slug?: string | undefined;
407
+ image?: string | undefined;
408
+ published?: boolean | undefined;
406
409
  tags?: ({
407
410
  name: string;
408
411
  } | {
@@ -410,9 +413,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
410
413
  name: string;
411
414
  slug: string;
412
415
  })[] | undefined;
413
- slug?: string | undefined;
414
- image?: string | undefined;
415
- published?: boolean | undefined;
416
416
  publishedAt?: unknown;
417
417
  createdAt?: unknown;
418
418
  updatedAt?: unknown;
@@ -448,6 +448,8 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
448
448
  title: string;
449
449
  content: string;
450
450
  excerpt: string;
451
+ image?: string | undefined;
452
+ published?: boolean | undefined;
451
453
  tags?: ({
452
454
  name: string;
453
455
  } | {
@@ -455,8 +457,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
455
457
  name: string;
456
458
  slug: string;
457
459
  })[] | undefined;
458
- image?: string | undefined;
459
- published?: boolean | undefined;
460
460
  publishedAt?: unknown;
461
461
  createdAt?: unknown;
462
462
  updatedAt?: unknown;
@@ -465,6 +465,8 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
465
465
  title: string;
466
466
  content: string;
467
467
  excerpt: string;
468
+ image?: string | undefined;
469
+ published?: boolean | undefined;
468
470
  tags?: ({
469
471
  name: string;
470
472
  } | {
@@ -472,8 +474,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
472
474
  name: string;
473
475
  slug: string;
474
476
  })[] | undefined;
475
- image?: string | undefined;
476
- published?: boolean | undefined;
477
477
  publishedAt?: unknown;
478
478
  createdAt?: unknown;
479
479
  updatedAt?: unknown;
@@ -627,6 +627,12 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
627
627
  total: number;
628
628
  }, false>;
629
629
  readonly createPost: _btst_stack_plugins_api.Operation<zod.ZodObject<{
630
+ slug: zod.ZodOptional<zod.ZodString>;
631
+ title: zod.ZodString;
632
+ content: zod.ZodString;
633
+ excerpt: zod.ZodString;
634
+ image: zod.ZodOptional<zod.ZodString>;
635
+ published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
630
636
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
631
637
  name: zod.ZodString;
632
638
  }, zod_v4_core.$strip>, zod.ZodObject<{
@@ -634,12 +640,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
634
640
  name: zod.ZodString;
635
641
  slug: zod.ZodString;
636
642
  }, zod_v4_core.$strip>]>>>>;
637
- slug: zod.ZodOptional<zod.ZodString>;
638
- title: zod.ZodString;
639
- content: zod.ZodString;
640
- excerpt: zod.ZodString;
641
- image: zod.ZodOptional<zod.ZodString>;
642
- published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
643
643
  publishedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
644
644
  createdAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
645
645
  updatedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
@@ -673,6 +673,12 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
673
673
  readonly updatePost: _btst_stack_plugins_api.Operation<zod.ZodObject<{
674
674
  id: zod.ZodString;
675
675
  data: zod.ZodObject<{
676
+ slug: zod.ZodString;
677
+ title: zod.ZodString;
678
+ content: zod.ZodString;
679
+ excerpt: zod.ZodString;
680
+ image: zod.ZodOptional<zod.ZodString>;
681
+ published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
676
682
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
677
683
  name: zod.ZodString;
678
684
  }, zod_v4_core.$strip>, zod.ZodObject<{
@@ -680,12 +686,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
680
686
  name: zod.ZodString;
681
687
  slug: zod.ZodString;
682
688
  }, zod_v4_core.$strip>]>>>>;
683
- slug: zod.ZodString;
684
- title: zod.ZodString;
685
- content: zod.ZodString;
686
- excerpt: zod.ZodString;
687
- image: zod.ZodOptional<zod.ZodString>;
688
- published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
689
689
  publishedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
690
690
  createdAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
691
691
  updatedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
@@ -900,8 +900,8 @@ declare const blogResources: {
900
900
  method: "POST";
901
901
  input: (vars: PostCreateInput) => {
902
902
  body: {
903
- published: boolean;
904
903
  title: string;
904
+ published: boolean;
905
905
  content: string;
906
906
  excerpt: string;
907
907
  tags: ({
@@ -1072,8 +1072,8 @@ declare function createBlogQueryKeys(client: ReturnType<typeof createApiClient<B
1072
1072
  method: "POST";
1073
1073
  input: (vars: PostCreateInput) => {
1074
1074
  body: {
1075
- published: boolean;
1076
1075
  title: string;
1076
+ published: boolean;
1077
1077
  content: string;
1078
1078
  excerpt: string;
1079
1079
  tags: ({
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
3
  import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.Csi-4Mgz.js';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.CKc_Bais.js';
6
6
  import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.js';
7
7
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
8
8
  import { DeepReadonly, OperationContext, OperationErrorContext } from '@btst/stack/plugins/api';
@@ -89,6 +89,12 @@ declare const NextPreviousPostsQuerySchema: z.ZodObject<{
89
89
  date: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
90
90
  }, z.core.$strip>;
91
91
  declare const CreatePostOperationInputSchema: z.ZodObject<{
92
+ slug: z.ZodOptional<z.ZodString>;
93
+ title: z.ZodString;
94
+ content: z.ZodString;
95
+ excerpt: z.ZodString;
96
+ image: z.ZodOptional<z.ZodString>;
97
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
92
98
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
93
99
  name: z.ZodString;
94
100
  }, z.core.$strip>, z.ZodObject<{
@@ -96,12 +102,6 @@ declare const CreatePostOperationInputSchema: z.ZodObject<{
96
102
  name: z.ZodString;
97
103
  slug: z.ZodString;
98
104
  }, z.core.$strip>]>>>>;
99
- slug: z.ZodOptional<z.ZodString>;
100
- title: z.ZodString;
101
- content: z.ZodString;
102
- excerpt: z.ZodString;
103
- image: z.ZodOptional<z.ZodString>;
104
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
105
105
  publishedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
106
106
  createdAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
107
107
  updatedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
@@ -109,6 +109,12 @@ declare const CreatePostOperationInputSchema: z.ZodObject<{
109
109
  declare const UpdatePostOperationInputSchema: z.ZodObject<{
110
110
  id: z.ZodString;
111
111
  data: z.ZodObject<{
112
+ slug: z.ZodString;
113
+ title: z.ZodString;
114
+ content: z.ZodString;
115
+ excerpt: z.ZodString;
116
+ image: z.ZodOptional<z.ZodString>;
117
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
118
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
113
119
  name: z.ZodString;
114
120
  }, z.core.$strip>, z.ZodObject<{
@@ -116,12 +122,6 @@ declare const UpdatePostOperationInputSchema: z.ZodObject<{
116
122
  name: z.ZodString;
117
123
  slug: z.ZodString;
118
124
  }, z.core.$strip>]>>>>;
119
- slug: z.ZodString;
120
- title: z.ZodString;
121
- content: z.ZodString;
122
- excerpt: z.ZodString;
123
- image: z.ZodOptional<z.ZodString>;
124
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
125
125
  publishedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
126
126
  createdAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
127
127
  updatedAt: z.ZodOptional<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>;
@@ -386,6 +386,9 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
386
386
  title: string;
387
387
  content: string;
388
388
  excerpt: string;
389
+ slug?: string | undefined;
390
+ image?: string | undefined;
391
+ published?: boolean | undefined;
389
392
  tags?: ({
390
393
  name: string;
391
394
  } | {
@@ -393,9 +396,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
393
396
  name: string;
394
397
  slug: string;
395
398
  })[] | undefined;
396
- slug?: string | undefined;
397
- image?: string | undefined;
398
- published?: boolean | undefined;
399
399
  publishedAt?: unknown;
400
400
  createdAt?: unknown;
401
401
  updatedAt?: unknown;
@@ -403,6 +403,9 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
403
403
  title: string;
404
404
  content: string;
405
405
  excerpt: string;
406
+ slug?: string | undefined;
407
+ image?: string | undefined;
408
+ published?: boolean | undefined;
406
409
  tags?: ({
407
410
  name: string;
408
411
  } | {
@@ -410,9 +413,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
410
413
  name: string;
411
414
  slug: string;
412
415
  })[] | undefined;
413
- slug?: string | undefined;
414
- image?: string | undefined;
415
- published?: boolean | undefined;
416
416
  publishedAt?: unknown;
417
417
  createdAt?: unknown;
418
418
  updatedAt?: unknown;
@@ -448,6 +448,8 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
448
448
  title: string;
449
449
  content: string;
450
450
  excerpt: string;
451
+ image?: string | undefined;
452
+ published?: boolean | undefined;
451
453
  tags?: ({
452
454
  name: string;
453
455
  } | {
@@ -455,8 +457,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
455
457
  name: string;
456
458
  slug: string;
457
459
  })[] | undefined;
458
- image?: string | undefined;
459
- published?: boolean | undefined;
460
460
  publishedAt?: unknown;
461
461
  createdAt?: unknown;
462
462
  updatedAt?: unknown;
@@ -465,6 +465,8 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
465
465
  title: string;
466
466
  content: string;
467
467
  excerpt: string;
468
+ image?: string | undefined;
469
+ published?: boolean | undefined;
468
470
  tags?: ({
469
471
  name: string;
470
472
  } | {
@@ -472,8 +474,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
472
474
  name: string;
473
475
  slug: string;
474
476
  })[] | undefined;
475
- image?: string | undefined;
476
- published?: boolean | undefined;
477
477
  publishedAt?: unknown;
478
478
  createdAt?: unknown;
479
479
  updatedAt?: unknown;
@@ -627,6 +627,12 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
627
627
  total: number;
628
628
  }, false>;
629
629
  readonly createPost: _btst_stack_plugins_api.Operation<zod.ZodObject<{
630
+ slug: zod.ZodOptional<zod.ZodString>;
631
+ title: zod.ZodString;
632
+ content: zod.ZodString;
633
+ excerpt: zod.ZodString;
634
+ image: zod.ZodOptional<zod.ZodString>;
635
+ published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
630
636
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
631
637
  name: zod.ZodString;
632
638
  }, zod_v4_core.$strip>, zod.ZodObject<{
@@ -634,12 +640,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
634
640
  name: zod.ZodString;
635
641
  slug: zod.ZodString;
636
642
  }, zod_v4_core.$strip>]>>>>;
637
- slug: zod.ZodOptional<zod.ZodString>;
638
- title: zod.ZodString;
639
- content: zod.ZodString;
640
- excerpt: zod.ZodString;
641
- image: zod.ZodOptional<zod.ZodString>;
642
- published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
643
643
  publishedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
644
644
  createdAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
645
645
  updatedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
@@ -673,6 +673,12 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
673
673
  readonly updatePost: _btst_stack_plugins_api.Operation<zod.ZodObject<{
674
674
  id: zod.ZodString;
675
675
  data: zod.ZodObject<{
676
+ slug: zod.ZodString;
677
+ title: zod.ZodString;
678
+ content: zod.ZodString;
679
+ excerpt: zod.ZodString;
680
+ image: zod.ZodOptional<zod.ZodString>;
681
+ published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
676
682
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
677
683
  name: zod.ZodString;
678
684
  }, zod_v4_core.$strip>, zod.ZodObject<{
@@ -680,12 +686,6 @@ declare const blogBackendPlugin: (options?: BlogBackendOptions) => _btst_stack_p
680
686
  name: zod.ZodString;
681
687
  slug: zod.ZodString;
682
688
  }, zod_v4_core.$strip>]>>>>;
683
- slug: zod.ZodString;
684
- title: zod.ZodString;
685
- content: zod.ZodString;
686
- excerpt: zod.ZodString;
687
- image: zod.ZodOptional<zod.ZodString>;
688
- published: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
689
689
  publishedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
690
690
  createdAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
691
691
  updatedAt: zod.ZodOptional<zod.ZodPipe<zod.ZodCoercedDate<unknown>, zod.ZodTransform<string, Date>>>;
@@ -900,8 +900,8 @@ declare const blogResources: {
900
900
  method: "POST";
901
901
  input: (vars: PostCreateInput) => {
902
902
  body: {
903
- published: boolean;
904
903
  title: string;
904
+ published: boolean;
905
905
  content: string;
906
906
  excerpt: string;
907
907
  tags: ({
@@ -1072,8 +1072,8 @@ declare function createBlogQueryKeys(client: ReturnType<typeof createApiClient<B
1072
1072
  method: "POST";
1073
1073
  input: (vars: PostCreateInput) => {
1074
1074
  body: {
1075
- published: boolean;
1076
1075
  title: string;
1076
+ published: boolean;
1077
1077
  content: string;
1078
1078
  excerpt: string;
1079
1079
  tags: ({
@@ -41,6 +41,20 @@ type SerializedMessage = Omit<Message, "createdAt"> & {
41
41
  createdAt: string;
42
42
  };
43
43
 
44
+ /** Server-owned content loader for the standard readPage tool. */
45
+ interface AiChatPageContentConfig {
46
+ /** Allowed page paths. Validated before resolve; paths are also limited to 16,000 characters. */
47
+ pathSchema: z.ZodType<string, string>;
48
+ /**
49
+ * Load the complete page as JSON-serializable reference material. Enforce
50
+ * publication and access rules here using the request context. Return null
51
+ * when unavailable. BTST never fetches URLs or truncates the returned content.
52
+ */
53
+ resolve: (path: string, context: ChatApiContext<ChatOperationInput>) => unknown | Promise<unknown>;
54
+ /** Optional model-facing description of the supported page types. */
55
+ description?: string;
56
+ }
57
+
44
58
  type AiChatAccess = "authorized" | "public";
45
59
  /** Runtime input for one conversation operation. */
46
60
  declare const ConversationOperationInputSchema: z.ZodObject<{
@@ -208,6 +222,8 @@ interface AiChatBackendConfig {
208
222
  access?: AiChatAccess;
209
223
  systemPrompt?: string;
210
224
  tools?: Record<string, Tool>;
225
+ /** Enable the standard readPage server tool for full page content. Reserves the readPage tool name. */
226
+ pageContent?: AiChatPageContentConfig;
211
227
  enablePageTools?: boolean;
212
228
  clientToolSchemas?: Record<string, Tool>;
213
229
  hooks?: AiChatBackendHooks;
@@ -503,5 +519,5 @@ declare function createAiChatQueryKeys(client: ReturnType<typeof createApiClient
503
519
  }>;
504
520
  type AiChatQueryKeys = ReturnType<typeof createAiChatQueryKeys>;
505
521
 
506
- export { UpdateConversationOperationInputSchema as U, aiChatIdentityKey as d, aiChatResources as e, createAiChatQueryKeys as f, aiChatBackendPlugin as i, AI_CHAT_OPERATION_INVENTORY as n, AI_CHAT_RAW_ESCAPE_HATCH_INVENTORY as o, AiChatOperationError as p, ChatOperationInputSchema as q, ConversationOperationInputSchema as r };
507
- export type { AiChatIdentityPartition as A, ConversationWithMessages as C, Message as M, RenameConversationInput as R, SerializedConversation as S, SerializedMessage as a, CreateConversationInput as b, Conversation as c, AiChatQueryKeys as g, AiChatBackendConfig as h, AiChatApiRouter as j, AiChatAccess as k, AiChatBackendHooks as l, ChatApiContext as m };
522
+ export { UpdateConversationOperationInputSchema as U, aiChatIdentityKey as d, aiChatResources as e, createAiChatQueryKeys as f, aiChatBackendPlugin as i, AI_CHAT_OPERATION_INVENTORY as o, AI_CHAT_RAW_ESCAPE_HATCH_INVENTORY as p, AiChatOperationError as q, ChatOperationInputSchema as r, ConversationOperationInputSchema as s };
523
+ export type { AiChatIdentityPartition as A, ConversationWithMessages as C, Message as M, RenameConversationInput as R, SerializedConversation as S, SerializedMessage as a, CreateConversationInput as b, Conversation as c, AiChatQueryKeys as g, AiChatBackendConfig as h, AiChatApiRouter as j, AiChatPageContentConfig as k, AiChatAccess as l, AiChatBackendHooks as m, ChatApiContext as n };
@@ -2,7 +2,7 @@ import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
4
4
  import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.js';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.Csi-4Mgz.js';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.CKc_Bais.js';
6
6
 
7
7
  /**
8
8
  * Options for the usePosts hook
@@ -136,6 +136,10 @@ declare function useSuspenseTags(): {
136
136
  declare function usePostForm<TValues>(config: ResourceFormConfig<TValues, SerializedPost | null, SerializedPost | null>): ResourceFormResult<TValues, SerializedPost | null, SerializedPost | null>;
137
137
  /** Create a new post */
138
138
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
139
+ title: string;
140
+ content: string;
141
+ excerpt: string;
142
+ published: boolean;
139
143
  tags: ({
140
144
  name: string;
141
145
  } | {
@@ -143,10 +147,6 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
143
147
  name: string;
144
148
  slug: string;
145
149
  })[];
146
- title: string;
147
- content: string;
148
- excerpt: string;
149
- published: boolean;
150
150
  slug?: string | undefined;
151
151
  publishedAt?: Date | undefined;
152
152
  createdAt?: Date | undefined;
@@ -41,6 +41,20 @@ type SerializedMessage = Omit<Message, "createdAt"> & {
41
41
  createdAt: string;
42
42
  };
43
43
 
44
+ /** Server-owned content loader for the standard readPage tool. */
45
+ interface AiChatPageContentConfig {
46
+ /** Allowed page paths. Validated before resolve; paths are also limited to 16,000 characters. */
47
+ pathSchema: z.ZodType<string, string>;
48
+ /**
49
+ * Load the complete page as JSON-serializable reference material. Enforce
50
+ * publication and access rules here using the request context. Return null
51
+ * when unavailable. BTST never fetches URLs or truncates the returned content.
52
+ */
53
+ resolve: (path: string, context: ChatApiContext<ChatOperationInput>) => unknown | Promise<unknown>;
54
+ /** Optional model-facing description of the supported page types. */
55
+ description?: string;
56
+ }
57
+
44
58
  type AiChatAccess = "authorized" | "public";
45
59
  /** Runtime input for one conversation operation. */
46
60
  declare const ConversationOperationInputSchema: z.ZodObject<{
@@ -208,6 +222,8 @@ interface AiChatBackendConfig {
208
222
  access?: AiChatAccess;
209
223
  systemPrompt?: string;
210
224
  tools?: Record<string, Tool>;
225
+ /** Enable the standard readPage server tool for full page content. Reserves the readPage tool name. */
226
+ pageContent?: AiChatPageContentConfig;
211
227
  enablePageTools?: boolean;
212
228
  clientToolSchemas?: Record<string, Tool>;
213
229
  hooks?: AiChatBackendHooks;
@@ -503,5 +519,5 @@ declare function createAiChatQueryKeys(client: ReturnType<typeof createApiClient
503
519
  }>;
504
520
  type AiChatQueryKeys = ReturnType<typeof createAiChatQueryKeys>;
505
521
 
506
- export { UpdateConversationOperationInputSchema as U, aiChatIdentityKey as d, aiChatResources as e, createAiChatQueryKeys as f, aiChatBackendPlugin as i, AI_CHAT_OPERATION_INVENTORY as n, AI_CHAT_RAW_ESCAPE_HATCH_INVENTORY as o, AiChatOperationError as p, ChatOperationInputSchema as q, ConversationOperationInputSchema as r };
507
- export type { AiChatIdentityPartition as A, ConversationWithMessages as C, Message as M, RenameConversationInput as R, SerializedConversation as S, SerializedMessage as a, CreateConversationInput as b, Conversation as c, AiChatQueryKeys as g, AiChatBackendConfig as h, AiChatApiRouter as j, AiChatAccess as k, AiChatBackendHooks as l, ChatApiContext as m };
522
+ export { UpdateConversationOperationInputSchema as U, aiChatIdentityKey as d, aiChatResources as e, createAiChatQueryKeys as f, aiChatBackendPlugin as i, AI_CHAT_OPERATION_INVENTORY as o, AI_CHAT_RAW_ESCAPE_HATCH_INVENTORY as p, AiChatOperationError as q, ChatOperationInputSchema as r, ConversationOperationInputSchema as s };
523
+ export type { AiChatIdentityPartition as A, ConversationWithMessages as C, Message as M, RenameConversationInput as R, SerializedConversation as S, SerializedMessage as a, CreateConversationInput as b, Conversation as c, AiChatQueryKeys as g, AiChatBackendConfig as h, AiChatApiRouter as j, AiChatPageContentConfig as k, AiChatAccess as l, AiChatBackendHooks as m, ChatApiContext as n };
@@ -1,6 +1,39 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { UIMessage } from 'ai';
3
- import { ComponentType, FormEvent } from 'react';
3
+ import { ComponentType, CSSProperties, FormEvent } from 'react';
4
+ import { PageAIContextConfig } from '../plugins/ai-chat/client/context/page-ai-context.cjs';
5
+
6
+ /** Content-free usage events. No prompts, answers, page descriptions, or tool outputs. */
7
+ type AiChatAnalyticsEvent = {
8
+ /** Caller-supplied page identity; omit sensitive values. */
9
+ pageKey?: string;
10
+ /** Page label, without its description or document content. */
11
+ routeName?: string;
12
+ /** Registered client mode, not an assertion about the viewer's identity. */
13
+ mode: AiChatMode;
14
+ } & ({
15
+ type: "widget_opened" | "widget_closed" | "intro_tip_shown" | "conversation_cleared";
16
+ } | {
17
+ type: "intro_tip_dismissed";
18
+ reason: "timeout" | "manual" | "open";
19
+ } | {
20
+ type: "suggestion_selected";
21
+ index: number;
22
+ } | {
23
+ type: "message_submitted";
24
+ inputKind: "typed" | "suggestion" | "edit" | "retry";
25
+ inputLength: number;
26
+ messageCount: number;
27
+ attachmentCount: number;
28
+ } | {
29
+ type: "response_completed";
30
+ durationMs: number;
31
+ outputLength: number;
32
+ toolCallCount: number;
33
+ } | {
34
+ type: "response_failed";
35
+ durationMs: number;
36
+ });
4
37
 
5
38
  /**
6
39
  * AI Chat plugin localization strings
@@ -69,6 +102,10 @@ interface AiChatLocalization {
69
102
  A11Y_CLEAR_CHAT: string;
70
103
  A11Y_CLOSE_CHAT: string;
71
104
  A11Y_OPEN_CHAT: string;
105
+ A11Y_DISMISS_CHAT_TIP: string;
106
+ PAGE_CONTENT_READING: string;
107
+ PAGE_CONTENT_READ: string;
108
+ PAGE_CONTENT_ERROR: string;
72
109
  A11Y_OPEN_MENU: string;
73
110
  A11Y_CLOSE_SIDEBAR: string;
74
111
  A11Y_OPEN_SIDEBAR: string;
@@ -94,6 +131,8 @@ type AiChatMode = "authenticated" | "public";
94
131
  interface AiChatProviderConfig {
95
132
  /** Conversation behavior selected by `aiChatClientPlugin()`. */
96
133
  readonly mode: AiChatMode;
134
+ /** Whether built-in page reader permission checks and status UI are enabled. */
135
+ readonly pageContent?: boolean;
97
136
  }
98
137
  /**
99
138
  * State of a tool call execution
@@ -152,6 +191,8 @@ interface RouteContext {
152
191
  * plugin-specific components and behavior.
153
192
  */
154
193
  interface AiChatPluginOverrides {
194
+ /** Optional content-free usage telemetry. Exceptions and rejections are isolated from chat. */
195
+ onAnalyticsEvent?: (event: AiChatAnalyticsEvent) => void | Promise<void>;
155
196
  /**
156
197
  * Function used to upload a file and return its URL.
157
198
  * Called for images, PDFs, text files, and other supported file types.
@@ -255,6 +296,15 @@ interface ChatLayoutBaseProps {
255
296
  conversationId?: string;
256
297
  /** Additional class name for the container */
257
298
  className?: string;
299
+ /** Additional container styles, including application-specific floating offsets. */
300
+ style?: CSSProperties;
301
+ /** Instance-local context. Omit to inherit page registrations; null disables them. */
302
+ pageContext?: PageAIContextConfig | null;
303
+ /**
304
+ * Page identity. Changing it resets the panel, tip, and conversation, stopping
305
+ * an active stream. Supply initialMessages/conversationId for this page only.
306
+ */
307
+ pageKey?: string;
258
308
  /** Whether to show the sidebar */
259
309
  showSidebar?: boolean;
260
310
  /** Initial messages to populate the chat (useful for localStorage persistence in public mode) */
@@ -267,10 +317,16 @@ interface ChatLayoutBaseProps {
267
317
  interface ChatLayoutWidgetProps extends ChatLayoutBaseProps {
268
318
  /** Widget mode: compact embeddable panel with a floating trigger button */
269
319
  layout: "widget";
270
- /** Height of the widget panel. Default: `"600px"` */
320
+ /** Height of the widget panel. Default: `"min(600px, calc(100dvh - 112px))"` */
271
321
  widgetHeight?: string | number;
272
- /** Width of the widget panel. Default: `"380px"` */
322
+ /** Width of the widget panel. Default: `"min(380px, calc(100vw - 32px))"` */
273
323
  widgetWidth?: string | number;
324
+ /** Fix the widget to the bottom right. Default: false (embedded). Override offsets with className or style. */
325
+ floating?: boolean;
326
+ /** Optional dismissible introduction shown while the widget is closed. */
327
+ introTip?: string;
328
+ /** Milliseconds before hiding the introduction. Default: 6000. */
329
+ introTipDuration?: number;
274
330
  /**
275
331
  * Whether the widget panel starts open. Default: `false`.
276
332
  * Set to `true` when embedding inside an already-open container such as a
@@ -355,4 +411,4 @@ declare function ChatInput({ input, handleInputChange, handleSubmit, isLoading,
355
411
  declare function ToolCallDisplay({ toolCallId, toolName, state, input, output, errorText, isLoading, }: ToolCallProps): react_jsx_runtime.JSX.Element;
356
412
 
357
413
  export { ChatInterface as C, DEFAULT_ALLOWED_FILE_TYPES as D, ChatLayout as f, ChatSidebar as h, ChatMessage as i, ChatInput as j, ToolCallDisplay as k };
358
- export type { AiChatMode as A, ToolCallProps as T, AiChatPluginOverrides as a, AiChatProviderConfig as b, AllowedFileType as c, ToolCallState as d, ToolCallRenderer as e, ChatLayoutProps as g };
414
+ export type { AiChatMode as A, ToolCallProps as T, AiChatPluginOverrides as a, AiChatProviderConfig as b, AllowedFileType as c, ToolCallState as d, ToolCallRenderer as e, ChatLayoutProps as g, AiChatAnalyticsEvent as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btst/stack",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "A composable, plugin-based library for building full-stack applications.",
5
5
  "repository": {
6
6
  "type": "git",