@abpjs/ui 0.0.0-stage → 0.2.0-next.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0-next.1
4
+
5
+ A prerelease under npm's `next` tag: the foundation and the first area, `ai`. More areas (`guard`, `agent`) follow in
6
+ later prereleases before 0.2.0.
7
+
8
+ The foundation for the screens (ADR 0109's amendment in the application it came from): areas under `src/areas`, each
9
+ its own entry, moving to its own package later by import path alone.
10
+
11
+ - The host contract: `AbpProvider`'s `host` (`AbpHost`): the host's `request`, a base path per package, `navigate`,
12
+ `can(right, scopeId?)`, scopes, people's names, languages, text overrides and slots. `createHostRequest` for a host
13
+ without its own (anti-forgery cookie and header, a 401 handed back, one retry after a step-up, files with their names).
14
+ - `useApiQuery`, `useApiAction`, `useApiDownload`, `useAreaRequest`, `useCan`, `useNavigate`, `useNames`,
15
+ `useHostLanguages`, `HostSlot`; `AbpApiError` reads ABP's error shape.
16
+ - `createHostEvents` and `useAreaEvents`: server-sent events resumed from the last id, a refusal thrown before the
17
+ stream; optional, so a host without it gets screens that ask again. `me` and `useMe` for the person signed in.
18
+ - `createAreaTexts` and `formatMessage`: an area's English and Arabic texts with plurals and choices, overridable by
19
+ the host.
20
+ - `FormDialog`, with the labels `formRequired` and `formFix`.
21
+ - `tests/areas-boundary.test.mjs` keeps each area to its boundary; prereleases publish under npm's `next` tag.
22
+ - **`@abpjs/ui/ai`**, AbpAi's screens on AbpAi.HttpApi 0.7.0 (`src/areas/ai`): the site's AI page in tabs (models,
23
+ aliases, each scope's access, limits, usage, exports) as `aiPages` and `AiAdmin`, a scope's AI as `AiScopeScreen`,
24
+ and their panels. Types from AbpAi's OpenAPI document; rights, slots and pages in its README.
25
+
26
+ ## 0.1.0
27
+
28
+ The design system as a package of its own (ADR 0109 in the application it came from).
29
+
30
+ - `createAbpSystem({ prefix, brand, config })` and `abpConfig`: the host's CSS variable prefix and colours on the
31
+ design system's tokens and recipes; the package's own neutral colours and the `abp` prefix when none are given.
32
+ - `AbpProvider` with the host's system, locale and direction, labels, link component, colour mode, motion setting,
33
+ time zone, confirm dialogs and the toaster.
34
+ - Components: the app shell, panels, tables (grouping, two levels, row drag), queryable lists with filters, grouping
35
+ and pagination, boards, timelines and cards, calendars, dashboards, charts, forms, pickers, the command search,
36
+ skeletons and motion.
37
+ - Settings areas: `settingsArea`, `findSettingsPage`, `SettingsLayout`, and the `SettingsPage` and `SettingsSection` types.
38
+ - `@abpjs/ui/rules`: query conditions, grouping, the breadcrumb fold and the settings order, with no React.
39
+ - Peers: React 19, Chakra UI 3.38 or later.
package/LICENSE ADDED
@@ -0,0 +1,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ @abpjs/ui
2
+ Copyright 2026 @abpjs/ui contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @abpjs/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The design system for ABP applications on **Chakra UI v3 and React 19**: tokens, recipes, an app shell, tables and
4
+ lists with filters and grouping, boards, timelines, calendars, forms, pickers, motion that respects reduced motion,
5
+ skeletons, a command search, and a settings frame that packages and plugins add pages to. Right-to-left languages work
6
+ throughout.
7
+
8
+ It is not `@abpjs/components` or `@abpjs/theme-shared`, which are ABP's own module components on React 18.
9
+
10
+ It names no product. The host gives its CSS variable prefix, its colours and its words.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install @abpjs/ui @chakra-ui/react @emotion/react next-themes react react-dom
16
+ ```
17
+
18
+ Peers: React 19, Chakra UI 3.38 or later (3.x), emotion 11, next-themes.
19
+
20
+ ## Use
21
+
22
+ ```tsx
23
+ import { AbpProvider, createAbpSystem } from '@abpjs/ui';
24
+
25
+ // Your prefix (the CSS variables are --acme-colors-bg and so on) and your colours; the package's own when left out.
26
+ const system = createAbpSystem({ prefix: 'acme', brand: acmeBrand });
27
+
28
+ export function Providers({ children, locale }: { children: React.ReactNode; locale: string }) {
29
+ return (
30
+ <AbpProvider system={system} locale={locale} productName="Acme" labels={translatedLabels}>
31
+ {children}
32
+ </AbpProvider>
33
+ );
34
+ }
35
+ ```
36
+
37
+ - **Words:** every component takes its words as props or from the provider's `labels`; the package has no
38
+ translations of its own and no i18n library.
39
+ - **Brand:** six scales (`neutral`, `accent`, `green`, `amber`, `red`, `blue`), light to dark; components only use the
40
+ semantic tokens (`bg`, `fg`, `border`, `accent`...), which pick steps per colour mode.
41
+ - **Fonts:** the host loads them and sets `--{prefix}-font-sans`, `--{prefix}-font-arabic` and `--{prefix}-font-mono`.
42
+ - **Settings:** `settingsArea(sections, pages)` orders an area's sections and pages by weight, then title, and leaves
43
+ out pages the person can't see; `SettingsLayout` draws the area; `findSettingsPage` serves a catch-all route.
44
+ - **Rules without React:** `@abpjs/ui/rules` has the query conditions, grouping, the breadcrumb fold and the settings
45
+ order, for code that can't load Chakra.
46
+
47
+ ## Develop
48
+
49
+ ```bash
50
+ npm ci
51
+ npm run typecheck
52
+ npm test
53
+ npm run build
54
+ npm run check:names
55
+ ```
56
+
57
+ Releases: a `v<version>` tag publishes to npm from CI. See [CHANGELOG.md](CHANGELOG.md).
58
+
59
+ ## Licence
60
+
61
+ Apache-2.0. See [LICENSE](LICENSE).
package/dist/ai.d.ts ADDED
@@ -0,0 +1,493 @@
1
+ import * as react from 'react';
2
+ import { SettingsPage, HostRequest } from '@abpjs/ui';
3
+
4
+ /** The site's AI page, with its header: what a host's catch-all route draws for `ai.admin`. */
5
+ declare function AiAdminPage(): react.JSX.Element;
6
+ /**
7
+ * The area's settings pages for a host to file under its sections: `ai.admin`, the site's AI (models, aliases, access,
8
+ * limits, usage, exports). The host gives where it opens and who sees it; the server checks every call anyway.
9
+ */
10
+ declare function aiPages(options: {
11
+ section: string;
12
+ href: string;
13
+ weight?: number;
14
+ title?: string;
15
+ about?: string;
16
+ visible?: SettingsPage['visible'];
17
+ }): SettingsPage[];
18
+
19
+ interface components {
20
+ schemas: {
21
+ AiAliasInfo: {
22
+ /** Format: uuid */
23
+ id: string;
24
+ /** Format: uuid */
25
+ scopeId: null | string;
26
+ name: string;
27
+ targets: components["schemas"]["AiAliasTarget"][];
28
+ /** Format: date-time */
29
+ updatedAt: string;
30
+ };
31
+ AiAliasTarget: {
32
+ /** Format: uuid */
33
+ connectionId: string;
34
+ model?: null | string;
35
+ };
36
+ AiCallRow: {
37
+ /** Format: uuid */
38
+ id: string;
39
+ /** Format: date-time */
40
+ at: string;
41
+ state: string;
42
+ code: null | string;
43
+ error: null | string;
44
+ /** Format: uuid */
45
+ scopeId: null | string;
46
+ scope: null | string;
47
+ /** Format: uuid */
48
+ accountId: null | string;
49
+ /** Format: uuid */
50
+ onBehalfOf: null | string;
51
+ purpose: string;
52
+ aboutKind: null | string;
53
+ aboutId: null | string;
54
+ alias: string;
55
+ connection: string;
56
+ provider: string;
57
+ model: string;
58
+ dataClass: string;
59
+ streamed: boolean;
60
+ /** Format: int32 */
61
+ inputTokens: number | string;
62
+ /** Format: int32 */
63
+ outputTokens: number | string;
64
+ /** Format: int32 */
65
+ cacheWriteTokens: number | string;
66
+ /** Format: int32 */
67
+ cacheReadTokens: number | string;
68
+ /** Format: double */
69
+ cost: number | string;
70
+ /** Format: int32 */
71
+ durationMs: null | number | string;
72
+ };
73
+ AiConnectionInfo: {
74
+ /** Format: uuid */
75
+ id: string;
76
+ /** Format: uuid */
77
+ scopeId: null | string;
78
+ name: string;
79
+ provider: string;
80
+ endpoint: string;
81
+ hasKey: boolean;
82
+ models: string[];
83
+ dataClasses: string[];
84
+ labels: string[];
85
+ settings: {
86
+ [key: string]: string;
87
+ };
88
+ /** Format: double */
89
+ inputPrice: number | string;
90
+ /** Format: double */
91
+ outputPrice: number | string;
92
+ modelPrices: {
93
+ [key: string]: components["schemas"]["AiPrice"];
94
+ };
95
+ structuredOutput: boolean;
96
+ enabled: boolean;
97
+ modelSettings?: {
98
+ [key: string]: components["schemas"]["AiModelSettings"];
99
+ };
100
+ /** Format: double */
101
+ cacheWritePrice?: null | number | string;
102
+ /** Format: double */
103
+ cacheReadPrice?: null | number | string;
104
+ /** Format: int32 */
105
+ idleTimeoutSeconds?: null | number | string;
106
+ /** Format: int32 */
107
+ totalTimeoutSeconds?: null | number | string;
108
+ type?: null | string;
109
+ test?: null | components["schemas"]["AiConnectionTest"];
110
+ };
111
+ AiConnectionInput: {
112
+ name: string;
113
+ provider: string;
114
+ models: string[];
115
+ dataClasses: string[];
116
+ modelSettings?: null | {
117
+ [key: string]: components["schemas"]["AiModelSettings"];
118
+ };
119
+ endpoint?: null | string;
120
+ apiKey?: null | string;
121
+ labels?: null | string[];
122
+ settings?: null | {
123
+ [key: string]: string;
124
+ };
125
+ /** Format: double */
126
+ inputPrice?: number | string;
127
+ /** Format: double */
128
+ outputPrice?: number | string;
129
+ modelPrices?: null | {
130
+ [key: string]: components["schemas"]["AiPrice"];
131
+ };
132
+ structuredOutput?: boolean;
133
+ enabled?: boolean;
134
+ /** Format: double */
135
+ cacheWritePrice?: null | number | string;
136
+ /** Format: double */
137
+ cacheReadPrice?: null | number | string;
138
+ /** Format: int32 */
139
+ idleTimeoutSeconds?: null | number | string;
140
+ /** Format: int32 */
141
+ totalTimeoutSeconds?: null | number | string;
142
+ test?: boolean;
143
+ };
144
+ AiConnectionTest: {
145
+ ok: boolean;
146
+ model: string;
147
+ /** Format: int32 */
148
+ elapsedMs: number | string;
149
+ /** Format: date-time */
150
+ at: string;
151
+ /** Format: int32 */
152
+ status?: null | number | string;
153
+ reason?: null | string;
154
+ };
155
+ AiExportInfo: {
156
+ /** Format: uuid */
157
+ id: string;
158
+ /** Format: date-time */
159
+ at: string;
160
+ /** Format: uuid */
161
+ actorId: string;
162
+ /** Format: date-time */
163
+ from: string;
164
+ /** Format: date-time */
165
+ to: string;
166
+ /** Format: uuid */
167
+ scopeId: null | string;
168
+ /** Format: int32 */
169
+ calls: number | string;
170
+ /** Format: int32 */
171
+ prompts: number | string;
172
+ truncated: boolean;
173
+ /** Format: int64 */
174
+ bytes: number | string;
175
+ /** Format: date-time */
176
+ expiresAt: string;
177
+ };
178
+ AiExportRequest: {
179
+ /** Format: date-time */
180
+ from: string;
181
+ /** Format: date-time */
182
+ to: string;
183
+ /** Format: uuid */
184
+ scopeId?: null | string;
185
+ };
186
+ AiLimitInfo: {
187
+ /** Format: uuid */
188
+ id: string;
189
+ /** Format: uuid */
190
+ scopeId: null | string;
191
+ kind: string;
192
+ period: string;
193
+ /** Format: double */
194
+ amount: number | string;
195
+ /** Format: uuid */
196
+ accountId: null | string;
197
+ /** Format: uuid */
198
+ groupId: null | string;
199
+ measure?: string;
200
+ };
201
+ AiLimitInput: {
202
+ kind: string;
203
+ period: string;
204
+ /** Format: double */
205
+ amount: number | string;
206
+ /** Format: uuid */
207
+ accountId?: null | string;
208
+ /** Format: uuid */
209
+ groupId?: null | string;
210
+ measure?: string;
211
+ };
212
+ AiModelRef: {
213
+ /** Format: uuid */
214
+ connectionId: string;
215
+ model: string;
216
+ };
217
+ AiModelSettings: {
218
+ name?: null | string;
219
+ enabled?: boolean;
220
+ tools?: boolean;
221
+ images?: boolean;
222
+ structuredOutput?: null | boolean;
223
+ embeds?: boolean;
224
+ /** Format: int32 */
225
+ contextTokens?: null | number | string;
226
+ /** Format: date-time */
227
+ priceSetAt?: null | string;
228
+ };
229
+ AiPrice: {
230
+ /** Format: double */
231
+ input: number | string;
232
+ /** Format: double */
233
+ output: number | string;
234
+ /** Format: double */
235
+ cacheWrite?: null | number | string;
236
+ /** Format: double */
237
+ cacheRead?: null | number | string;
238
+ };
239
+ AiRecentQuery: {
240
+ /** Format: date-time */
241
+ from: string;
242
+ /** Format: date-time */
243
+ to: string;
244
+ /** Format: uuid */
245
+ scopeId?: null | string;
246
+ /**
247
+ * Format: int32
248
+ * @default 50
249
+ */
250
+ count: number | string;
251
+ states?: null | string[];
252
+ };
253
+ AiScopeAccessInfo: {
254
+ /** Format: uuid */
255
+ scopeId: string;
256
+ /** Format: uuid */
257
+ setOnScopeId: null | string;
258
+ allSiteModels: boolean;
259
+ siteModels: components["schemas"]["AiModelRef"][];
260
+ mayConnect: boolean;
261
+ };
262
+ AiScopeAccessInput: {
263
+ allSiteModels: boolean;
264
+ siteModels: null | components["schemas"]["AiModelRef"][];
265
+ mayConnect: boolean;
266
+ };
267
+ AiSiteSettings: {
268
+ scopesMayConnect: boolean;
269
+ keepPrompts: boolean;
270
+ /** Format: int32 */
271
+ promptDays: number | string;
272
+ scopeDataClasses: string[];
273
+ dataClasses: string[];
274
+ scopeAccess?: null | string;
275
+ };
276
+ AiUsageQuery: {
277
+ /** Format: date-time */
278
+ from: string;
279
+ /** Format: date-time */
280
+ to: string;
281
+ /** Format: uuid */
282
+ scopeId?: null | string;
283
+ /** @default scope */
284
+ groupBy: string;
285
+ /** Format: uuid */
286
+ accountId?: null | string;
287
+ purpose?: null | string;
288
+ model?: null | string;
289
+ states?: null | string[];
290
+ };
291
+ AiUsageReport: {
292
+ query: components["schemas"]["AiUsageQuery"];
293
+ rows: components["schemas"]["AiUsageRow"][];
294
+ total: components["schemas"]["AiUsageRow"];
295
+ };
296
+ AiUsageRow: {
297
+ key: string;
298
+ title: null | string;
299
+ /** Format: int32 */
300
+ calls: number | string;
301
+ /** Format: int64 */
302
+ inputTokens: number | string;
303
+ /** Format: int64 */
304
+ outputTokens: number | string;
305
+ /** Format: double */
306
+ cost: number | string;
307
+ /** Format: int32 */
308
+ failed?: number | string;
309
+ /** Format: int32 */
310
+ refused?: number | string;
311
+ /** Format: int64 */
312
+ cacheWriteTokens?: number | string;
313
+ /** Format: int64 */
314
+ cacheReadTokens?: number | string;
315
+ };
316
+ };
317
+ responses: never;
318
+ parameters: never;
319
+ requestBodies: never;
320
+ headers: never;
321
+ pathItems: never;
322
+ }
323
+
324
+ type Schemas = components['schemas'];
325
+ /** AbpAi.HttpApi's types, as its OpenAPI document gives them (`api.d.ts`). */
326
+ type AiTypes = Schemas;
327
+ type AiSite = Schemas['AiSiteSettings'];
328
+ type AiConnection = Schemas['AiConnectionInfo'];
329
+ type AiConnectionInput = Schemas['AiConnectionInput'];
330
+ type AiModelSettings = Schemas['AiModelSettings'];
331
+ type AiAlias = Schemas['AiAliasInfo'];
332
+ type AiAliasTarget = Schemas['AiAliasTarget'];
333
+ type AiLimit = Schemas['AiLimitInfo'];
334
+ type AiLimitInput = Schemas['AiLimitInput'];
335
+ type AiScopeAccess = Schemas['AiScopeAccessInfo'];
336
+ type AiScopeAccessInput = Schemas['AiScopeAccessInput'];
337
+ type AiUsageReport = Schemas['AiUsageReport'];
338
+ type AiUsageRow = Schemas['AiUsageRow'];
339
+ type AiCall = Schemas['AiCallRow'];
340
+ type AiExport = Schemas['AiExportInfo'];
341
+ /** A number the API may give as a string (its decimals and 64-bit counts). */
342
+ declare const num: (value: number | string | null | undefined) => number;
343
+
344
+ /**
345
+ * Whether the host keeps the connections itself (AbpAi's `IAiConnectionSource`), so the screens don't change them:
346
+ * the site's own word when the server gives it, else the host's `ai.connections.edit` right (AbpAi.HttpApi 0.7.0
347
+ * doesn't say).
348
+ */
349
+ declare function useHostKeepsConnections(site: AiSite | undefined, scopeId?: string): boolean;
350
+ /**
351
+ * The site's AI in tabs: the models each connection offers, the site's aliases, what each scope may use and its
352
+ * limits, the site's limits, the usage ledger, a quick call to try an alias (the host's `ai.try`), and exports of calls.
353
+ */
354
+ declare function AiAdmin(): react.JSX.Element;
355
+
356
+ /**
357
+ * A scope's AI, for a host's own scope settings page (its header is the host's): what the site opens to it, its own
358
+ * connections' models while it may have them, its aliases, its limits inside the site's, its usage, and a quick call
359
+ * through an alias (the host's `ai.try`). The site's models and limits show where the person may read the site's.
360
+ */
361
+ declare function AiScopeScreen({ scopeId }: {
362
+ scopeId: string;
363
+ }): react.JSX.Element;
364
+
365
+ /** One model of one connection, as the screens show it: its settings with AbpAi's defaults filled in. */
366
+ interface AiModelRow {
367
+ /** `connectionId:model`: what an alias target and a scope's opened models are keyed by. */
368
+ key: string;
369
+ connectionId: string;
370
+ connection: string;
371
+ scopeId: string | null;
372
+ modelId: string;
373
+ name: string;
374
+ enabled: boolean;
375
+ tools: boolean;
376
+ images: boolean;
377
+ structuredOutput: boolean;
378
+ contextTokens: number | null;
379
+ /** Per million tokens; null when neither the model nor its connection has a price. */
380
+ inputPrice: number | null;
381
+ outputPrice: number | null;
382
+ priceSetAt: string | null;
383
+ }
384
+ declare const modelKey: (connectionId: string, model: string | null | undefined) => string;
385
+ /** Every model of the connections, in their order. A model with no settings is on and takes tools (AbpAi's defaults). */
386
+ declare function modelRows(connections: readonly AiConnection[]): AiModelRow[];
387
+ /**
388
+ * The connection as an update with one model's settings and price changed. Everything else goes back as it is; its key
389
+ * isn't sent, so the server keeps it.
390
+ */
391
+ declare function withModel(c: AiConnection, model: string, settings: AiModelSettings, price: {
392
+ input: number;
393
+ output: number;
394
+ } | null): AiConnectionInput;
395
+
396
+ /**
397
+ * What each scope may use: none by default; every model of the site's that's on, or some; its own connections; its
398
+ * limits. Every scope the host lists, with the ones AbpAi has settings for that it didn't list named through
399
+ * `scopes.name`. A host adds a column through the `ai.access.cell` slot and fields to the dialog through
400
+ * `ai.access.editor`.
401
+ */
402
+ declare function AccessPanel({ models }: {
403
+ models: AiModelRow[];
404
+ }): react.JSX.Element;
405
+
406
+ /**
407
+ * Aliases ("fast", "smart"): what skills and steps name. The site's or a scope's own are edited here, each to its first
408
+ * model (the ones after it, if any, stay as they are); a scope also sees the aliases it gets from above that it doesn't
409
+ * replace (`inherited`).
410
+ */
411
+ declare function AliasesPanel({ scopeId, aliases, inherited, models, onSaved }: {
412
+ scopeId?: string;
413
+ aliases: AiAlias[] | undefined;
414
+ inherited?: AiAlias[];
415
+ models: AiModelRow[];
416
+ onSaved: () => Promise<void> | void;
417
+ }): react.JSX.Element;
418
+
419
+ /**
420
+ * Exports of AI calls for support: a period's calls, up to 31 days, one line of JSON each (gzipped), with their prompts
421
+ * and replies only where the site keeps them. Asked for with the password again (the host's step-up); each export and
422
+ * download is in the security log. Kept a week.
423
+ */
424
+ declare function ExportsPanel({ scopeId }: {
425
+ scopeId?: string;
426
+ }): react.JSX.Element;
427
+
428
+ /** What a row of the editor says: what it counts (`cost`, `tokens`, `requests`) or `call-tokens`, over which period, how much. */
429
+ type LimitRow = {
430
+ kind: string;
431
+ period: string;
432
+ amount: string;
433
+ };
434
+ declare const LIMIT_KINDS: readonly ["cost", "tokens", "requests", "call-tokens"];
435
+ declare const LIMIT_PERIODS: readonly ["minute", "day", "month"];
436
+ /** The limits this editor shows and changes: a scope's (or the site's) totals and its tokens per reply, not a person's or a group's. */
437
+ declare const editableLimit: (l: AiLimit) => boolean;
438
+ declare const limitRow: (l: AiLimit) => LimitRow;
439
+ /**
440
+ * Saves the editor's rows on the site or a scope: the limits no row keeps as they were are deleted, then the new and
441
+ * changed ones are set. A person's and a group's limits are left alone.
442
+ */
443
+ declare function saveLimits(request: HostRequest, scopeId: string | null | undefined, before: readonly AiLimit[], rows: readonly LimitRow[]): Promise<void>;
444
+ /** "Cost per day: 5", "Tokens per reply: 2,000". */
445
+ declare function useLimitText(): (l: AiLimit) => string;
446
+ /**
447
+ * Limits on a scope or the site: cost, tokens or requests per minute, day or month, and tokens per reply. With `onSave`
448
+ * it has its own Save button; with `onChange` (inside a larger form) it reports every change instead.
449
+ */
450
+ declare function LimitsEditor({ limits, onSave, onChange, busy, error }: {
451
+ limits: AiLimit[];
452
+ onSave?: (rows: LimitRow[]) => Promise<void> | void;
453
+ onChange?: (rows: LimitRow[]) => void;
454
+ busy?: boolean;
455
+ error?: string | null;
456
+ }): react.JSX.Element;
457
+
458
+ /**
459
+ * Models: each connection's, found by asking it, off until enabled, with what they can do and their prices per million
460
+ * tokens. Where the host keeps the connections itself (`hostKeeps`), the screen doesn't change them: each row shows the
461
+ * host's `ai.models.edit` and the panel its `ai.models.actions`.
462
+ */
463
+ declare function ModelsPanel({ scopeId, connections, rows, loading, hostKeeps, onChanged, title, description }: {
464
+ scopeId?: string;
465
+ /** The connections whose models are listed and may be changed here. */
466
+ connections: AiConnection[] | undefined;
467
+ /** Rows to list in place of the connections' (a scope's opened models and its own); its own are still changed through `connections`. */
468
+ rows?: AiModelRow[];
469
+ loading?: boolean;
470
+ hostKeeps: boolean;
471
+ onChanged: () => Promise<void> | void;
472
+ title: string;
473
+ description: string;
474
+ }): react.JSX.Element;
475
+
476
+ /** How usage is summed, in the screens' words, and AbpAi's group for each. */
477
+ declare const USAGE_BY: {
478
+ readonly project: "scope";
479
+ readonly model: "model";
480
+ readonly purpose: "purpose";
481
+ readonly account: "account";
482
+ };
483
+ type UsageBy = keyof typeof USAGE_BY;
484
+ /** The usage ledger for the site or a scope: summed by what's asked for, this month or an earlier one, with the latest calls. */
485
+ declare function UsagePanel({ scopeId, by: byOptions }: {
486
+ scopeId?: string;
487
+ by: UsageBy[];
488
+ }): react.JSX.Element;
489
+
490
+ /** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.ai`. */
491
+ declare const useAiTexts: () => (key: string, values?: Record<string, string | number>) => string;
492
+
493
+ export { AccessPanel, AiAdmin, AiAdminPage, type AiAlias, type AiAliasTarget, type AiCall, type AiConnection, type AiConnectionInput, type AiExport, type AiLimit, type AiLimitInput, type AiModelRow, type AiModelSettings, type AiScopeAccess, type AiScopeAccessInput, AiScopeScreen, type AiSite, type AiTypes, type AiUsageReport, type AiUsageRow, AliasesPanel, ExportsPanel, LIMIT_KINDS, LIMIT_PERIODS, type LimitRow, LimitsEditor, ModelsPanel, USAGE_BY, type UsageBy, UsagePanel, aiPages, editableLimit, limitRow, modelKey, modelRows, num, saveLimits, useAiTexts, useHostKeepsConnections, useLimitText, withModel };