@btst/stack 2.3.0 → 2.5.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/dist/packages/stack/src/client/components/compose.cjs +1 -2
- package/dist/packages/stack/src/client/components/compose.mjs +1 -2
- package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.cjs +71 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.mjs +68 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +87 -54
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +87 -54
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.cjs +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.mjs +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.cjs +89 -22
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.mjs +90 -23
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.cjs +110 -33
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.mjs +112 -35
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +1 -1
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +1 -1
- package/dist/packages/stack/src/plugins/ai-chat/client/plugin.cjs +14 -21
- package/dist/packages/stack/src/plugins/ai-chat/client/plugin.mjs +15 -22
- package/dist/packages/stack/src/plugins/ai-chat/schemas.cjs +17 -1
- package/dist/packages/stack/src/plugins/ai-chat/schemas.mjs +17 -1
- package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +28 -45
- package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +22 -39
- package/dist/packages/stack/src/plugins/blog/client/components/forms/post-forms.cjs +15 -2
- package/dist/packages/stack/src/plugins/blog/client/components/forms/post-forms.mjs +16 -3
- package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +24 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +24 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.cjs +26 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.mjs +24 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.cjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.mjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +23 -27
- package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +24 -28
- package/dist/packages/stack/src/plugins/cms/api/mutations.cjs +48 -0
- package/dist/packages/stack/src/plugins/cms/api/mutations.mjs +46 -0
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +21 -18
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +21 -18
- package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +11 -15
- package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +12 -16
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +58 -62
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +58 -62
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +12 -12
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +13 -13
- package/dist/packages/stack/src/plugins/kanban/api/mutations.cjs +91 -0
- package/dist/packages/stack/src/plugins/kanban/api/mutations.mjs +87 -0
- package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +92 -118
- package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +89 -115
- package/dist/packages/stack/src/plugins/kanban/client/hooks/kanban-hooks.cjs +7 -3
- package/dist/packages/stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +7 -3
- package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +22 -29
- package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +23 -30
- package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.cjs +89 -0
- package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.mjs +89 -0
- package/dist/packages/stack/src/plugins/ui-builder/client/plugin.cjs +8 -8
- package/dist/packages/stack/src/plugins/ui-builder/client/plugin.mjs +9 -9
- package/dist/packages/stack/src/plugins/utils.cjs +42 -0
- package/dist/packages/stack/src/plugins/utils.mjs +41 -1
- package/dist/plugins/ai-chat/api/index.d.cts +1 -1
- package/dist/plugins/ai-chat/api/index.d.mts +1 -1
- package/dist/plugins/ai-chat/api/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.cts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.mts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/context/page-ai-context.cjs +92 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.cts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.mts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.ts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.mjs +88 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.cts +1 -1
- package/dist/plugins/ai-chat/client/hooks/index.d.mts +1 -1
- package/dist/plugins/ai-chat/client/hooks/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/index.d.cts +10 -10
- package/dist/plugins/ai-chat/client/index.d.mts +10 -10
- package/dist/plugins/ai-chat/client/index.d.ts +10 -10
- package/dist/plugins/ai-chat/query-keys.d.cts +1 -1
- package/dist/plugins/ai-chat/query-keys.d.mts +1 -1
- package/dist/plugins/ai-chat/query-keys.d.ts +1 -1
- package/dist/plugins/blog/api/index.d.cts +2 -2
- package/dist/plugins/blog/api/index.d.mts +2 -2
- package/dist/plugins/blog/api/index.d.ts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +13 -13
- package/dist/plugins/blog/client/index.d.mts +13 -13
- package/dist/plugins/blog/client/index.d.ts +13 -13
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/client/index.cjs +1 -0
- package/dist/plugins/client/index.d.cts +8 -1
- package/dist/plugins/client/index.d.mts +8 -1
- package/dist/plugins/client/index.d.ts +8 -1
- package/dist/plugins/client/index.mjs +1 -1
- package/dist/plugins/cms/api/index.cjs +2 -0
- package/dist/plugins/cms/api/index.d.cts +2 -2
- package/dist/plugins/cms/api/index.d.mts +2 -2
- package/dist/plugins/cms/api/index.d.ts +2 -2
- package/dist/plugins/cms/api/index.mjs +1 -0
- package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
- package/dist/plugins/cms/client/index.d.cts +6 -6
- package/dist/plugins/cms/client/index.d.mts +6 -6
- package/dist/plugins/cms/client/index.d.ts +6 -6
- package/dist/plugins/cms/query-keys.d.cts +2 -2
- package/dist/plugins/cms/query-keys.d.mts +2 -2
- package/dist/plugins/cms/query-keys.d.ts +2 -2
- package/dist/plugins/form-builder/api/index.d.cts +2 -2
- package/dist/plugins/form-builder/api/index.d.mts +2 -2
- package/dist/plugins/form-builder/api/index.d.ts +2 -2
- package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/index.d.cts +6 -6
- package/dist/plugins/form-builder/client/index.d.mts +6 -6
- package/dist/plugins/form-builder/client/index.d.ts +6 -6
- package/dist/plugins/form-builder/query-keys.d.cts +2 -2
- package/dist/plugins/form-builder/query-keys.d.mts +2 -2
- package/dist/plugins/form-builder/query-keys.d.ts +2 -2
- package/dist/plugins/kanban/api/index.cjs +4 -0
- package/dist/plugins/kanban/api/index.d.cts +1 -1
- package/dist/plugins/kanban/api/index.d.mts +1 -1
- package/dist/plugins/kanban/api/index.d.ts +1 -1
- package/dist/plugins/kanban/api/index.mjs +1 -0
- package/dist/plugins/kanban/client/index.d.cts +12 -12
- package/dist/plugins/kanban/client/index.d.mts +12 -12
- package/dist/plugins/kanban/client/index.d.ts +12 -12
- package/dist/plugins/kanban/query-keys.d.cts +1 -1
- package/dist/plugins/kanban/query-keys.d.mts +1 -1
- package/dist/plugins/kanban/query-keys.d.ts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/ui-builder/client/index.d.cts +3 -3
- package/dist/plugins/ui-builder/client/index.d.mts +3 -3
- package/dist/plugins/ui-builder/client/index.d.ts +3 -3
- package/dist/plugins/ui-builder/index.d.cts +2 -2
- package/dist/plugins/ui-builder/index.d.mts +2 -2
- package/dist/plugins/ui-builder/index.d.ts +2 -2
- package/dist/shared/{stack.C-WUPMT6.d.cts → stack.B2xZTSiO.d.cts} +4 -4
- package/dist/shared/{stack.B1EeBt1b.d.ts → stack.B58oHdqm.d.mts} +33 -3
- package/dist/shared/{stack.CVDTkMoO.d.mts → stack.B8QD11QU.d.cts} +7 -7
- package/dist/shared/{stack.CVDTkMoO.d.cts → stack.B8QD11QU.d.mts} +7 -7
- package/dist/shared/{stack.CVDTkMoO.d.ts → stack.B8QD11QU.d.ts} +7 -7
- package/dist/shared/{stack.CIP6QS9l.d.ts → stack.BDVEpue1.d.ts} +1 -1
- package/dist/shared/{stack.C5dtIncc.d.mts → stack.BTvbxZvw.d.cts} +1 -1
- package/dist/shared/{stack.DaOcgmrM.d.ts → stack.BV9hnvu4.d.cts} +31 -7
- package/dist/shared/{stack.DaOcgmrM.d.cts → stack.BV9hnvu4.d.mts} +31 -7
- package/dist/shared/{stack.DaOcgmrM.d.mts → stack.BV9hnvu4.d.ts} +31 -7
- package/dist/shared/{stack.DdI5W6MB.d.mts → stack.BozPgbrZ.d.cts} +19 -19
- package/dist/shared/{stack.DdI5W6MB.d.ts → stack.BozPgbrZ.d.mts} +19 -19
- package/dist/shared/{stack.DdI5W6MB.d.cts → stack.BozPgbrZ.d.ts} +19 -19
- package/dist/shared/{stack.CP68pFEH.d.mts → stack.C9Mg2Q46.d.cts} +33 -3
- package/dist/shared/{stack.BeSm90va.d.ts → stack.CTDVxbrA.d.ts} +72 -14
- package/dist/shared/{stack.C-Ptrz8s.d.ts → stack.Cj_zKww4.d.ts} +4 -4
- package/dist/shared/{stack.TIBF2AOx.d.ts → stack.CxaFNQCV.d.mts} +89 -34
- package/dist/shared/{stack.CMh_EdxW.d.cts → stack.D-b5zbPm.d.cts} +72 -14
- package/dist/shared/{stack.Dw0Ly2TM.d.cts → stack.DTtmJPQO.d.mts} +1 -1
- package/dist/shared/{stack.BKfolAyK.d.ts → stack.DXnclTG7.d.ts} +11 -11
- package/dist/shared/{stack.snB1EDP7.d.cts → stack.DaZM10cp.d.cts} +11 -11
- package/dist/shared/{stack.Dg09R0oB.d.mts → stack.FVWf2JhZ.d.mts} +72 -14
- package/dist/shared/{stack.BIXEI6v_.d.mts → stack.cfCkioTe.d.mts} +11 -11
- package/dist/shared/{stack.6fUOjLs9.d.mts → stack.dH7u-TJH.d.mts} +4 -4
- package/dist/shared/{stack.BpolpQpf.d.cts → stack.j75TpKh2.d.ts} +89 -34
- package/dist/shared/{stack.rTy7-wQU.d.mts → stack.n1_i1p2B.d.cts} +89 -34
- package/dist/shared/{stack.IdtKDRka.d.cts → stack.sO33ZDhK.d.ts} +33 -3
- package/package.json +14 -1
- package/src/client/components/compose.tsx +7 -4
- package/src/plugins/ai-chat/api/page-tools.ts +111 -0
- package/src/plugins/ai-chat/api/plugin.ts +228 -72
- package/src/plugins/ai-chat/client/components/chat-input.tsx +2 -2
- package/src/plugins/ai-chat/client/components/chat-interface.tsx +154 -58
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +166 -32
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +1 -1
- package/src/plugins/ai-chat/client/context/page-ai-context.tsx +240 -0
- package/src/plugins/ai-chat/client/plugin.tsx +23 -31
- package/src/plugins/ai-chat/schemas.ts +16 -0
- package/src/plugins/blog/api/plugin.ts +31 -47
- package/src/plugins/blog/client/components/forms/post-forms.tsx +29 -2
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +28 -0
- package/src/plugins/blog/client/components/pages/fill-blog-form-handler.ts +38 -0
- package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +33 -1
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +20 -0
- package/src/plugins/blog/client/plugin.tsx +36 -39
- package/src/plugins/client/index.ts +5 -1
- package/src/plugins/cms/api/index.ts +4 -0
- package/src/plugins/cms/api/mutations.ts +84 -0
- package/src/plugins/cms/api/plugin.ts +23 -17
- package/src/plugins/cms/client/plugin.tsx +18 -21
- package/src/plugins/cms/types.ts +7 -7
- package/src/plugins/form-builder/api/plugin.ts +64 -64
- package/src/plugins/form-builder/client/plugin.tsx +19 -18
- package/src/plugins/form-builder/types.ts +19 -24
- package/src/plugins/kanban/api/index.ts +6 -0
- package/src/plugins/kanban/api/mutations.ts +169 -0
- package/src/plugins/kanban/api/plugin.ts +123 -136
- package/src/plugins/kanban/client/hooks/kanban-hooks.tsx +4 -0
- package/src/plugins/kanban/client/plugin.tsx +35 -41
- package/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.tsx +132 -0
- package/src/plugins/ui-builder/client/plugin.tsx +11 -10
- package/src/plugins/ui-builder/types.ts +4 -4
- package/src/plugins/utils.ts +92 -1
- package/dist/shared/{stack.CBON0dWL.d.mts → stack.BQmuNl5p.d.cts} +2 -2
- package/dist/shared/{stack.CBON0dWL.d.ts → stack.BQmuNl5p.d.mts} +2 -2
- package/dist/shared/{stack.CBON0dWL.d.cts → stack.BQmuNl5p.d.ts} +2 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { Adapter } from '@btst/db';
|
|
4
|
-
import { B as BoardWithColumns,
|
|
4
|
+
import { B as BoardWithColumns, P as Priority, T as Task, d as Board, e as Column, C as ColumnWithTasks } from './stack.DJaKVY7v.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { QueryClient } from '@tanstack/react-query';
|
|
7
7
|
|
|
8
8
|
declare const createBoardSchema: z.ZodObject<{
|
|
9
9
|
description: z.ZodOptional<z.ZodString>;
|
|
10
10
|
name: z.ZodString;
|
|
11
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
12
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
13
11
|
slug: z.ZodOptional<z.ZodString>;
|
|
14
12
|
ownerId: z.ZodOptional<z.ZodString>;
|
|
15
13
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
declare const updateBoardSchema: z.ZodObject<{
|
|
18
18
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -28,8 +28,8 @@ declare const createColumnSchema: z.ZodObject<{
|
|
|
28
28
|
title: z.ZodString;
|
|
29
29
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
30
30
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
31
|
-
boardId: z.ZodString;
|
|
32
31
|
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
32
|
+
boardId: z.ZodString;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
declare const updateColumnSchema: z.ZodObject<{
|
|
35
35
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -109,6 +109,58 @@ declare function getAllBoards(adapter: Adapter, params?: z.infer<typeof BoardLis
|
|
|
109
109
|
*/
|
|
110
110
|
declare function getBoardById(adapter: Adapter, id: string): Promise<BoardWithColumns | null>;
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Input for creating a new Kanban task.
|
|
114
|
+
*/
|
|
115
|
+
interface CreateKanbanTaskInput {
|
|
116
|
+
title: string;
|
|
117
|
+
columnId: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
priority?: Priority;
|
|
120
|
+
assigneeId?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Create a new task in a Kanban column.
|
|
124
|
+
* Computes the next order value from existing tasks in the column.
|
|
125
|
+
*
|
|
126
|
+
* @remarks **Security:** No authorization hooks (onBeforeCreateTask) are called.
|
|
127
|
+
* The caller is responsible for any access-control checks before invoking this
|
|
128
|
+
* function.
|
|
129
|
+
*
|
|
130
|
+
* @param adapter - The database adapter
|
|
131
|
+
* @param input - Task creation input
|
|
132
|
+
*/
|
|
133
|
+
declare function createKanbanTask(adapter: Adapter, input: CreateKanbanTaskInput): Promise<Task>;
|
|
134
|
+
/**
|
|
135
|
+
* Find a board by slug, or create it with the given name and custom column titles.
|
|
136
|
+
*
|
|
137
|
+
* Concurrency-safe at two levels:
|
|
138
|
+
* - **Same process**: concurrent calls with the same slug share a single in-flight
|
|
139
|
+
* Promise (via `_pendingBoardCreations`), so only one DB write is attempted.
|
|
140
|
+
* - **Cross-instance**: the DB `unique` constraint on `slug` causes the losing
|
|
141
|
+
* write to throw; the catch block re-fetches and returns the winner's board.
|
|
142
|
+
*
|
|
143
|
+
* @remarks **Security:** No authorization hooks are called. The caller is
|
|
144
|
+
* responsible for any access-control checks before invoking this function.
|
|
145
|
+
*
|
|
146
|
+
* @param adapter - The database adapter
|
|
147
|
+
* @param slug - Unique URL-safe slug for the board
|
|
148
|
+
* @param name - Display name for the board (used only on creation)
|
|
149
|
+
* @param columnTitles - Ordered list of column names to create (used only on creation)
|
|
150
|
+
*/
|
|
151
|
+
declare function findOrCreateKanbanBoard(adapter: Adapter, slug: string, name: string, columnTitles: string[]): Promise<Board>;
|
|
152
|
+
/**
|
|
153
|
+
* Retrieve all columns for a given board, sorted by order.
|
|
154
|
+
* Co-located with mutations because it is primarily used alongside
|
|
155
|
+
* {@link createKanbanTask} to resolve column IDs before task creation.
|
|
156
|
+
*
|
|
157
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
158
|
+
*
|
|
159
|
+
* @param adapter - The database adapter
|
|
160
|
+
* @param boardId - The board ID
|
|
161
|
+
*/
|
|
162
|
+
declare function getKanbanColumnsByBoardId(adapter: Adapter, boardId: string): Promise<Column[]>;
|
|
163
|
+
|
|
112
164
|
/**
|
|
113
165
|
* Route keys for the Kanban plugin — matches the keys returned by
|
|
114
166
|
* `stackClient.router.getRoute(path).routeKey`.
|
|
@@ -137,25 +189,25 @@ interface KanbanApiContext<TBody = unknown, TParams = unknown, TQuery = unknown>
|
|
|
137
189
|
*/
|
|
138
190
|
interface KanbanBackendHooks {
|
|
139
191
|
/**
|
|
140
|
-
* Called before listing boards.
|
|
192
|
+
* Called before listing boards. Throw an error to deny access.
|
|
141
193
|
*/
|
|
142
|
-
onBeforeListBoards?: (filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<
|
|
194
|
+
onBeforeListBoards?: (filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
143
195
|
/**
|
|
144
|
-
* Called before creating a board.
|
|
196
|
+
* Called before creating a board. Throw an error to deny access.
|
|
145
197
|
*/
|
|
146
|
-
onBeforeCreateBoard?: (data: z.infer<typeof createBoardSchema>, context: KanbanApiContext) => Promise<
|
|
198
|
+
onBeforeCreateBoard?: (data: z.infer<typeof createBoardSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
147
199
|
/**
|
|
148
|
-
* Called before reading a single board.
|
|
200
|
+
* Called before reading a single board. Throw an error to deny access.
|
|
149
201
|
*/
|
|
150
|
-
onBeforeReadBoard?: (boardId: string, context: KanbanApiContext) => Promise<
|
|
202
|
+
onBeforeReadBoard?: (boardId: string, context: KanbanApiContext) => Promise<void> | void;
|
|
151
203
|
/**
|
|
152
|
-
* Called before updating a board.
|
|
204
|
+
* Called before updating a board. Throw an error to deny access.
|
|
153
205
|
*/
|
|
154
|
-
onBeforeUpdateBoard?: (boardId: string, data: z.infer<typeof updateBoardSchema>, context: KanbanApiContext) => Promise<
|
|
206
|
+
onBeforeUpdateBoard?: (boardId: string, data: z.infer<typeof updateBoardSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
155
207
|
/**
|
|
156
|
-
* Called before deleting a board.
|
|
208
|
+
* Called before deleting a board. Throw an error to deny access.
|
|
157
209
|
*/
|
|
158
|
-
onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<
|
|
210
|
+
onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<void> | void;
|
|
159
211
|
/**
|
|
160
212
|
* Called after boards are listed successfully.
|
|
161
213
|
* Receives the items array (same shape as `board[]`) for consistency
|
|
@@ -199,17 +251,17 @@ interface KanbanBackendHooks {
|
|
|
199
251
|
*/
|
|
200
252
|
onDeleteBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
|
|
201
253
|
/**
|
|
202
|
-
* Called before creating a column.
|
|
254
|
+
* Called before creating a column. Throw an error to deny access.
|
|
203
255
|
*/
|
|
204
|
-
onBeforeCreateColumn?: (data: z.infer<typeof createColumnSchema>, context: KanbanApiContext) => Promise<
|
|
256
|
+
onBeforeCreateColumn?: (data: z.infer<typeof createColumnSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
205
257
|
/**
|
|
206
|
-
* Called before updating a column.
|
|
258
|
+
* Called before updating a column. Throw an error to deny access.
|
|
207
259
|
*/
|
|
208
|
-
onBeforeUpdateColumn?: (columnId: string, data: z.infer<typeof updateColumnSchema>, context: KanbanApiContext) => Promise<
|
|
260
|
+
onBeforeUpdateColumn?: (columnId: string, data: z.infer<typeof updateColumnSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
209
261
|
/**
|
|
210
|
-
* Called before deleting a column.
|
|
262
|
+
* Called before deleting a column. Throw an error to deny access.
|
|
211
263
|
*/
|
|
212
|
-
onBeforeDeleteColumn?: (columnId: string, context: KanbanApiContext) => Promise<
|
|
264
|
+
onBeforeDeleteColumn?: (columnId: string, context: KanbanApiContext) => Promise<void> | void;
|
|
213
265
|
/**
|
|
214
266
|
* Called after a column is created successfully
|
|
215
267
|
*/
|
|
@@ -223,17 +275,17 @@ interface KanbanBackendHooks {
|
|
|
223
275
|
*/
|
|
224
276
|
onColumnDeleted?: (columnId: string, context: KanbanApiContext) => Promise<void> | void;
|
|
225
277
|
/**
|
|
226
|
-
* Called before creating a task.
|
|
278
|
+
* Called before creating a task. Throw an error to deny access.
|
|
227
279
|
*/
|
|
228
|
-
onBeforeCreateTask?: (data: z.infer<typeof createTaskSchema>, context: KanbanApiContext) => Promise<
|
|
280
|
+
onBeforeCreateTask?: (data: z.infer<typeof createTaskSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
229
281
|
/**
|
|
230
|
-
* Called before updating a task.
|
|
282
|
+
* Called before updating a task. Throw an error to deny access.
|
|
231
283
|
*/
|
|
232
|
-
onBeforeUpdateTask?: (taskId: string, data: z.infer<typeof updateTaskSchema>, context: KanbanApiContext) => Promise<
|
|
284
|
+
onBeforeUpdateTask?: (taskId: string, data: z.infer<typeof updateTaskSchema>, context: KanbanApiContext) => Promise<void> | void;
|
|
233
285
|
/**
|
|
234
|
-
* Called before deleting a task.
|
|
286
|
+
* Called before deleting a task. Throw an error to deny access.
|
|
235
287
|
*/
|
|
236
|
-
onBeforeDeleteTask?: (taskId: string, context: KanbanApiContext) => Promise<
|
|
288
|
+
onBeforeDeleteTask?: (taskId: string, context: KanbanApiContext) => Promise<void> | void;
|
|
237
289
|
/**
|
|
238
290
|
* Called after a task is created successfully
|
|
239
291
|
*/
|
|
@@ -272,11 +324,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
272
324
|
body: z.ZodObject<{
|
|
273
325
|
description: z.ZodOptional<z.ZodString>;
|
|
274
326
|
name: z.ZodString;
|
|
275
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
276
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
277
327
|
slug: z.ZodOptional<z.ZodString>;
|
|
278
328
|
ownerId: z.ZodOptional<z.ZodString>;
|
|
279
329
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
330
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
331
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
280
332
|
}, z.core.$strip>;
|
|
281
333
|
}, {
|
|
282
334
|
columns: ColumnWithTasks[];
|
|
@@ -294,11 +346,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
294
346
|
body: z.ZodObject<{
|
|
295
347
|
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
296
348
|
name: z.ZodOptional<z.ZodString>;
|
|
297
|
-
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
298
|
-
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
299
349
|
slug: z.ZodOptional<z.ZodString>;
|
|
300
350
|
ownerId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
301
351
|
organizationId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
352
|
+
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
353
|
+
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
302
354
|
}, z.core.$strip>;
|
|
303
355
|
}, Board>;
|
|
304
356
|
readonly deleteBoard: better_call.StrictEndpoint<"/boards/:id", {
|
|
@@ -312,8 +364,8 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
312
364
|
title: z.ZodString;
|
|
313
365
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
314
366
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
315
|
-
boardId: z.ZodString;
|
|
316
367
|
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
368
|
+
boardId: z.ZodString;
|
|
317
369
|
}, z.core.$strip>;
|
|
318
370
|
}, Column>;
|
|
319
371
|
readonly updateColumn: better_call.StrictEndpoint<"/columns/:id", {
|
|
@@ -322,8 +374,8 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
322
374
|
title: z.ZodOptional<z.ZodString>;
|
|
323
375
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
324
376
|
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
325
|
-
boardId: z.ZodOptional<z.ZodString>;
|
|
326
377
|
order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
|
|
378
|
+
boardId: z.ZodOptional<z.ZodString>;
|
|
327
379
|
}, z.core.$strip>;
|
|
328
380
|
}, Column>;
|
|
329
381
|
readonly deleteColumn: better_call.StrictEndpoint<"/columns/:id", {
|
|
@@ -406,6 +458,9 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
406
458
|
getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
|
|
407
459
|
getBoardById: (id: string) => Promise<BoardWithColumns | null>;
|
|
408
460
|
prefetchForRoute: KanbanPrefetchForRoute;
|
|
461
|
+
createTask: (input: Parameters<typeof createKanbanTask>[1]) => Promise<Task>;
|
|
462
|
+
findOrCreateBoard: (slug: string, name: string, columnTitles: string[]) => Promise<Board>;
|
|
463
|
+
getColumnsByBoardId: (boardId: string) => Promise<Column[]>;
|
|
409
464
|
}>;
|
|
410
465
|
type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
|
|
411
466
|
|
|
@@ -441,5 +496,5 @@ declare const KANBAN_QUERY_KEYS: {
|
|
|
441
496
|
boardDetail: (boardId: string) => readonly ["boards", "detail", string];
|
|
442
497
|
};
|
|
443
498
|
|
|
444
|
-
export { getBoardById as d,
|
|
445
|
-
export type { BoardListResult as B, KanbanApiRouter as K, KanbanRouteKey as a, KanbanApiContext as b, KanbanBackendHooks as c, BoardsListDiscriminator as
|
|
499
|
+
export { getBoardById as d, createKanbanTask as e, findOrCreateKanbanBoard as f, getAllBoards as g, getKanbanColumnsByBoardId as h, KANBAN_QUERY_KEYS as i, kanbanBackendPlugin as k };
|
|
500
|
+
export type { BoardListResult as B, CreateKanbanTaskInput as C, KanbanApiRouter as K, KanbanRouteKey as a, KanbanApiContext as b, KanbanBackendHooks as c, BoardsListDiscriminator as j };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
-
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.
|
|
2
|
+
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.B8QD11QU.js';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Adapter } from '@btst/db';
|
|
@@ -78,6 +78,35 @@ declare function getContentItemById(adapter: Adapter, id: string): Promise<Seria
|
|
|
78
78
|
*/
|
|
79
79
|
declare function getContentItemBySlug(adapter: Adapter, contentTypeSlug: string, slug: string): Promise<SerializedContentItemWithType | null>;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Input for creating a new CMS content item.
|
|
83
|
+
*/
|
|
84
|
+
interface CreateCMSContentItemInput {
|
|
85
|
+
/** URL-safe slug for the item */
|
|
86
|
+
slug: string;
|
|
87
|
+
/** Arbitrary data payload — should match the content type schema */
|
|
88
|
+
data: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a new content item for a content type (looked up by slug).
|
|
92
|
+
*
|
|
93
|
+
* Bypasses Zod schema validation and relation processing — the caller is
|
|
94
|
+
* responsible for providing valid, relation-free data. For relation fields or
|
|
95
|
+
* schema validation, use the HTTP endpoint instead.
|
|
96
|
+
*
|
|
97
|
+
* Throws if the content type is not found or the slug is already taken within
|
|
98
|
+
* that content type.
|
|
99
|
+
*
|
|
100
|
+
* @remarks **Security:** No authorization hooks (`onBeforeCreate`, `onAfterCreate`)
|
|
101
|
+
* are called. The caller is responsible for any access-control checks before
|
|
102
|
+
* invoking this function.
|
|
103
|
+
*
|
|
104
|
+
* @param adapter - The database adapter
|
|
105
|
+
* @param contentTypeSlug - Slug of the target content type
|
|
106
|
+
* @param input - Item slug and data payload
|
|
107
|
+
*/
|
|
108
|
+
declare function createCMSContentItem(adapter: Adapter, contentTypeSlug: string, input: CreateCMSContentItemInput): Promise<SerializedContentItem>;
|
|
109
|
+
|
|
81
110
|
/**
|
|
82
111
|
* Route keys for the CMS plugin — matches the keys returned by
|
|
83
112
|
* `stackClient.router.getRoute(path).routeKey`.
|
|
@@ -257,6 +286,7 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
257
286
|
getContentItemBySlug: (contentTypeSlug: string, slug: string) => Promise<SerializedContentItemWithType<Record<string, unknown>> | null>;
|
|
258
287
|
getContentItemById: (id: string) => Promise<SerializedContentItemWithType<Record<string, unknown>> | null>;
|
|
259
288
|
prefetchForRoute: CMSPrefetchForRoute;
|
|
289
|
+
createContentItem: (typeSlug: string, input: Parameters<typeof createCMSContentItem>[2]) => Promise<SerializedContentItem>;
|
|
260
290
|
}>;
|
|
261
291
|
type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
|
|
262
292
|
|
|
@@ -293,5 +323,5 @@ declare const CMS_QUERY_KEYS: {
|
|
|
293
323
|
contentDetail: (typeSlug: string, id: string) => readonly ["cmsContent", "detail", string, string];
|
|
294
324
|
};
|
|
295
325
|
|
|
296
|
-
export { cmsBackendPlugin as c, getAllContentItems as d, getContentItemBySlug as e, getContentItemById as f, getAllContentTypes as g, serializeContentItem as h, serializeContentItemWithType as i,
|
|
297
|
-
export type { CMSApiRouter as C, ContentListDiscriminator as a, CMSRouteKey as b };
|
|
326
|
+
export { cmsBackendPlugin as c, getAllContentItems as d, getContentItemBySlug as e, getContentItemById as f, getAllContentTypes as g, serializeContentItem as h, serializeContentItemWithType as i, createCMSContentItem as j, CMS_QUERY_KEYS as l, serializeContentType as s };
|
|
327
|
+
export type { CMSApiRouter as C, ContentListDiscriminator as a, CMSRouteKey as b, CreateCMSContentItemInput as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btst/stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A composable, plugin-based library for building full-stack applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -163,6 +163,16 @@
|
|
|
163
163
|
"default": "./dist/plugins/ai-chat/client/hooks/index.cjs"
|
|
164
164
|
}
|
|
165
165
|
},
|
|
166
|
+
"./plugins/ai-chat/client/context": {
|
|
167
|
+
"import": {
|
|
168
|
+
"types": "./dist/plugins/ai-chat/client/context/page-ai-context.d.ts",
|
|
169
|
+
"default": "./dist/plugins/ai-chat/client/context/page-ai-context.mjs"
|
|
170
|
+
},
|
|
171
|
+
"require": {
|
|
172
|
+
"types": "./dist/plugins/ai-chat/client/context/page-ai-context.d.cts",
|
|
173
|
+
"default": "./dist/plugins/ai-chat/client/context/page-ai-context.cjs"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
166
176
|
"./plugins/ai-chat/css": "./dist/plugins/ai-chat/style.css",
|
|
167
177
|
"./plugins/blog/css": "./dist/plugins/blog/style.css",
|
|
168
178
|
"./plugins/cms/api": {
|
|
@@ -392,6 +402,9 @@
|
|
|
392
402
|
"plugins/ai-chat/client/hooks": [
|
|
393
403
|
"./dist/plugins/ai-chat/client/hooks/index.d.ts"
|
|
394
404
|
],
|
|
405
|
+
"plugins/ai-chat/client/context": [
|
|
406
|
+
"./dist/plugins/ai-chat/client/context/page-ai-context.d.ts"
|
|
407
|
+
],
|
|
395
408
|
"plugins/cms/api": [
|
|
396
409
|
"./dist/plugins/cms/api/index.d.ts"
|
|
397
410
|
],
|
|
@@ -89,10 +89,13 @@ export function ComposedRoute({
|
|
|
89
89
|
}) {
|
|
90
90
|
if (PageComponent) {
|
|
91
91
|
const content = <PageComponent {...props} />;
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
// Always provide the same fallback on server and client — using
|
|
93
|
+
// `typeof window !== "undefined"` here would produce a different JSX tree
|
|
94
|
+
// on each side, shifting React's useId() counter and causing hydration
|
|
95
|
+
// mismatches in any descendant that uses Radix (Select, Dialog, etc.).
|
|
96
|
+
// If the Suspense boundary never actually suspends during SSR (data is
|
|
97
|
+
// prefetched), React won't emit the fallback into the HTML anyway.
|
|
98
|
+
const suspenseFallback = LoadingComponent ? <LoadingComponent /> : null;
|
|
96
99
|
|
|
97
100
|
// If an ErrorComponent is provided (which itself may be lazy), ensure we have
|
|
98
101
|
// a Suspense boundary that can handle both the page content and the lazy error UI
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import type { Tool } from "ai";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Maps each built-in page tool to the route names that are permitted to request it.
|
|
7
|
+
*
|
|
8
|
+
* The server cross-checks the `routeName` field sent with every chat request
|
|
9
|
+
* against this allowlist before including a built-in tool in the streamText call.
|
|
10
|
+
* A tool is only activated when both conditions are true:
|
|
11
|
+
* 1. The tool name appears in the request's `availableTools` list, AND
|
|
12
|
+
* 2. The request's `routeName` is in this tool's allowlist.
|
|
13
|
+
*
|
|
14
|
+
* Consumer-defined tools (via `clientToolSchemas`) are not validated here —
|
|
15
|
+
* the consumer is responsible for their own access control.
|
|
16
|
+
*/
|
|
17
|
+
export const BUILT_IN_PAGE_TOOL_ROUTE_ALLOWLIST: Record<string, string[]> = {
|
|
18
|
+
/** Blog new-post and edit-post pages */
|
|
19
|
+
fillBlogForm: ["blog-new-post", "blog-edit-post", "newPost", "editPost"],
|
|
20
|
+
/** UI builder edit page */
|
|
21
|
+
updatePageLayers: ["ui-builder-edit-page"],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Built-in client-side-only tool schemas for route-aware AI context.
|
|
26
|
+
*
|
|
27
|
+
* These tools have no `execute` function — they are handled on the client side
|
|
28
|
+
* via the onToolCall handler in ChatInterface, which dispatches to handlers
|
|
29
|
+
* registered by pages via useRegisterPageAIContext.
|
|
30
|
+
*
|
|
31
|
+
* Consumers can add their own tool schemas via `clientToolSchemas` in AiChatBackendConfig.
|
|
32
|
+
*/
|
|
33
|
+
export const BUILT_IN_PAGE_TOOL_SCHEMAS: Record<string, Tool> = {
|
|
34
|
+
/**
|
|
35
|
+
* Fill in the blog post editor form fields.
|
|
36
|
+
* Registered by blog new/edit page via useRegisterPageAIContext.
|
|
37
|
+
*/
|
|
38
|
+
fillBlogForm: tool({
|
|
39
|
+
description:
|
|
40
|
+
"Fill in the blog post editor form fields. Call this when the user asks to write, draft, or populate a blog post. You can fill any combination of title, content, excerpt, and tags.",
|
|
41
|
+
inputSchema: z.object({
|
|
42
|
+
title: z.string().optional().describe("The post title"),
|
|
43
|
+
content: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe(
|
|
47
|
+
"Full markdown content for the post body. Use proper markdown formatting with headings, lists, etc.",
|
|
48
|
+
),
|
|
49
|
+
excerpt: z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("A short summary/excerpt of the post (1-2 sentences)"),
|
|
53
|
+
tags: z
|
|
54
|
+
.array(z.string())
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("Array of tag names to apply to the post"),
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Replace the UI builder page layers with new ones.
|
|
62
|
+
* Registered by the UI builder edit page via useRegisterPageAIContext.
|
|
63
|
+
*/
|
|
64
|
+
updatePageLayers: tool({
|
|
65
|
+
description: `Replace the UI builder page component layers. Call this when the user asks to change, add, redesign, or update the page layout and components.
|
|
66
|
+
|
|
67
|
+
Rules:
|
|
68
|
+
- Provide the COMPLETE layer tree, not a partial diff. The entire tree will replace the current layers.
|
|
69
|
+
- Only use component types that appear in the "Available Component Types" list in the page context.
|
|
70
|
+
- Every layer must have a unique \`id\` string (e.g. "hero-section", "card-title-1").
|
|
71
|
+
- The \`type\` field must exactly match a name from the component registry (e.g. "div", "Button", "Card", "Flexbox").
|
|
72
|
+
- The \`name\` field is the human-readable label shown in the layers panel.
|
|
73
|
+
- \`props\` contains component-specific props (className uses Tailwind classes).
|
|
74
|
+
- \`children\` is either an array of child ComponentLayer objects, or a plain string for text content.
|
|
75
|
+
- Use \`Flexbox\` or \`Grid\` for layout instead of raw div flex/grid when possible.
|
|
76
|
+
- Preserve any layers the user has not asked to change — read the current layers from the page context first.
|
|
77
|
+
- ALWAYS use shadcn/ui semantic color tokens in className (e.g. bg-background, bg-card, bg-primary, text-foreground, text-muted-foreground, text-primary-foreground, border-border) instead of hardcoded Tailwind colors like bg-white, bg-gray-*, text-black, etc. This ensures the UI automatically adapts to light and dark themes.`,
|
|
78
|
+
inputSchema: z.object({
|
|
79
|
+
layers: z
|
|
80
|
+
.array(
|
|
81
|
+
z.object({
|
|
82
|
+
id: z.string().describe("Unique identifier for this layer"),
|
|
83
|
+
type: z
|
|
84
|
+
.string()
|
|
85
|
+
.describe(
|
|
86
|
+
"Component type — must match a key in the component registry (e.g. 'div', 'Button', 'Card', 'Flexbox')",
|
|
87
|
+
),
|
|
88
|
+
name: z
|
|
89
|
+
.string()
|
|
90
|
+
.describe(
|
|
91
|
+
"Human-readable display name shown in the layers panel",
|
|
92
|
+
),
|
|
93
|
+
props: z
|
|
94
|
+
.record(z.string(), z.any())
|
|
95
|
+
.describe(
|
|
96
|
+
"Component props object. Use Tailwind classes for className. See the component registry for valid props per type.",
|
|
97
|
+
),
|
|
98
|
+
children: z
|
|
99
|
+
.any()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe(
|
|
102
|
+
"Child layers (array of ComponentLayer) or plain text string",
|
|
103
|
+
),
|
|
104
|
+
}),
|
|
105
|
+
)
|
|
106
|
+
.describe(
|
|
107
|
+
"Complete replacement layer tree. Must include ALL layers for the page, not just changed ones.",
|
|
108
|
+
),
|
|
109
|
+
}),
|
|
110
|
+
}),
|
|
111
|
+
};
|