@8wave/ai-elements 0.114.0-beta.28 → 0.114.0-beta.43

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 (45) hide show
  1. package/dist/_chunks/{PkToolShowSources-Sc1W6WHe.js → PkToolShowSources-Bfx-Th_j.js} +2 -2
  2. package/dist/_chunks/{PkToolShowSources-Sc1W6WHe.js.map → PkToolShowSources-Bfx-Th_j.js.map} +1 -1
  3. package/dist/_chunks/{markdown-BrvkrEUr.js → markdown-BL7WANiX.js} +10 -3
  4. package/dist/_chunks/markdown-BL7WANiX.js.map +1 -0
  5. package/dist/ai-elements.es.js +138 -28
  6. package/dist/ai-elements.es.js.map +1 -1
  7. package/dist-vue/PkChatbot.js +1 -1
  8. package/dist-vue/PkChatbotMessages.js +1 -1
  9. package/dist-vue/PkChatbotViewChat.js +1 -1
  10. package/dist-vue/PkChatbotViewFiles.js +1 -1
  11. package/dist-vue/_chunks/{Document-p2Y_4gk8.js → Document-nCWwJC2h.js} +10 -3
  12. package/dist-vue/_chunks/Document-nCWwJC2h.js.map +1 -0
  13. package/dist-vue/_chunks/{PkChatbot-Dn_6yrFw.js → PkChatbot-CXQzBuxy.js} +3 -3
  14. package/dist-vue/_chunks/{PkChatbot-Dn_6yrFw.js.map → PkChatbot-CXQzBuxy.js.map} +1 -1
  15. package/dist-vue/_chunks/{PkChatbotMessages-Yaf_5xJV.js → PkChatbotMessages-KH5RE8Dk.js} +3 -3
  16. package/dist-vue/_chunks/{PkChatbotMessages-Yaf_5xJV.js.map → PkChatbotMessages-KH5RE8Dk.js.map} +1 -1
  17. package/dist-vue/_chunks/{PkChatbotViewChat-DFYw4nzP.js → PkChatbotViewChat-D5sfTMCW.js} +3 -3
  18. package/dist-vue/_chunks/{PkChatbotViewChat-DFYw4nzP.js.map → PkChatbotViewChat-D5sfTMCW.js.map} +1 -1
  19. package/dist-vue/_chunks/{PkChatbotViewFiles-BBBO5hyd.js → PkChatbotViewFiles-Bk9-K6Hw.js} +2 -2
  20. package/dist-vue/_chunks/{PkChatbotViewFiles-BBBO5hyd.js.map → PkChatbotViewFiles-Bk9-K6Hw.js.map} +1 -1
  21. package/dist-vue/_chunks/{PkToolShowDiagram-WyUnnDUn.js → PkToolShowDiagram-CztnTdq2.js} +2 -2
  22. package/dist-vue/_chunks/{PkToolShowDiagram-WyUnnDUn.js.map → PkToolShowDiagram-CztnTdq2.js.map} +1 -1
  23. package/dist-vue/_chunks/{PkToolShowSources-BItTltB5.js → PkToolShowSources-CyR2GTiE.js} +2 -2
  24. package/dist-vue/_chunks/{PkToolShowSources-BItTltB5.js.map → PkToolShowSources-CyR2GTiE.js.map} +1 -1
  25. package/dist-vue/composables.js +134 -24
  26. package/dist-vue/composables.js.map +1 -1
  27. package/dist-vue/index.js +379 -377
  28. package/dist-vue/index.js.map +1 -1
  29. package/dist-vue/packages/auth/src/add-member-to-organization.d.ts +8 -2
  30. package/dist-vue/packages/auth/src/organization-member-limit.d.ts +12 -0
  31. package/dist-vue/packages/auth/src/two-factor-admin-plugin.d.ts +2 -0
  32. package/dist-vue/packages/auth/src/two-factor-policy-client-plugin.d.ts +105 -2
  33. package/dist-vue/packages/auth/src/two-factor-policy-plugin.d.ts +43 -2
  34. package/dist-vue/packages/models/src/schema/Document.d.ts +17 -0
  35. package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +10 -0
  36. package/dist-vue/packages/models/src/schema/DocumentSyncSource.d.ts +71 -1
  37. package/dist-vue/packages/models/src/schema/Lead.d.ts +1 -1
  38. package/dist-vue/packages/models/src/schema/Member.d.ts +7 -0
  39. package/dist-vue/packages/models/src/schema/Notification.d.ts +29 -0
  40. package/dist-vue/packages/models/src/schema/Organization.d.ts +19 -0
  41. package/dist-vue/packages/models/src/schema/SignInSecurity.d.ts +168 -0
  42. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  43. package/package.json +1 -1
  44. package/dist/_chunks/markdown-BrvkrEUr.js.map +0 -1
  45. package/dist-vue/_chunks/Document-p2Y_4gk8.js.map +0 -1
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Adds a user as member of an organization if not already present.
3
- * Shared by external-auth and organization-auto-join flows.
3
+ * Shared by external-auth and organization-auto-join flows. Only auto-join
4
+ * passes `respectMemberLimit`: the widget's external login must never fail
5
+ * because the organization is full. An automatic join does not take a seat
6
+ * an open invitation holds either, and a skipped one is not retried at the
7
+ * next sign-in: the person joins through an invitation once a seat is free.
4
8
  */
5
- export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role?: string): Promise<boolean>;
9
+ export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role?: string, { respectMemberLimit }?: {
10
+ respectMemberLimit?: boolean;
11
+ }): Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether an organization already holds as many members as the limit the
3
+ * system panel set on it. An organization with no limit is never full.
4
+ * With `countPendingInvitations` an open invitation holds a seat until it is
5
+ * accepted or expires, so a new one cannot be sent for a seat another
6
+ * invitation already promised. The count runs outside the write that
7
+ * follows, like better-auth's own check: two joins racing for the last seat
8
+ * can both pass.
9
+ */
10
+ export declare function isOrganizationFull(organizationId: string, { countPendingInvitations, }?: {
11
+ countPendingInvitations?: boolean;
12
+ }): Promise<boolean>;
@@ -0,0 +1,2 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ export declare function twoFactorAdmin(): BetterAuthPlugin;
@@ -1,4 +1,44 @@
1
+ import { SignInSecurityState } from '../../models/src';
1
2
  import { BetterFetch } from 'better-auth/client';
3
+ /**
4
+ * What `GET /two-factor-policy/user-security` answers to a system
5
+ * administrator, see docs/specs/two-factor-system-assistance.md (D3). Dates
6
+ * arrive as ISO strings.
7
+ */
8
+ export interface UserSignInSecurity {
9
+ state: SignInSecurityState;
10
+ factor: {
11
+ enabled: boolean;
12
+ method: 'totp' | 'otp' | null;
13
+ backupCodesRemaining: number | null;
14
+ /** Wrong codes in a row since the last right one. */
15
+ failedAttempts: number;
16
+ /** Set only while the pause after too many wrong codes lasts. */
17
+ lockedUntil: string | null;
18
+ };
19
+ passkeys: {
20
+ id: string;
21
+ name: string | null;
22
+ /** `multiDevice` when synced across the user's devices. */
23
+ deviceType: string;
24
+ backedUp: boolean;
25
+ createdAt: string | null;
26
+ }[];
27
+ trustedDevices: {
28
+ count: number;
29
+ lastExpiresAt: string | null;
30
+ };
31
+ hasPassword: boolean;
32
+ requiredBy: {
33
+ id: string;
34
+ name: string;
35
+ }[];
36
+ /** The latest changes, from the notices the user received. */
37
+ changes: {
38
+ action: string;
39
+ createdAt: string;
40
+ }[];
41
+ }
2
42
  /** What `GET /two-factor-policy/status` answers. */
3
43
  export interface TwoFactorStatus {
4
44
  enabled: boolean;
@@ -19,8 +59,9 @@ export interface TwoFactorStatus {
19
59
  passkeys: number;
20
60
  }
21
61
  /**
22
- * Client counterpart of the server `twoFactorPolicy()` plugin, see
23
- * docs/specs/two-factor-authentication.md.
62
+ * Client counterpart of the server `twoFactorPolicy()` and `twoFactorAdmin()`
63
+ * plugins, see docs/specs/two-factor-authentication.md and
64
+ * docs/specs/two-factor-system-assistance.md.
24
65
  */
25
66
  export declare function twoFactorPolicyClient(): {
26
67
  id: "two-factor-policy";
@@ -52,9 +93,71 @@ export declare function twoFactorPolicyClient(): {
52
93
  };
53
94
  error: null;
54
95
  }>;
96
+ userSecurity: (query: {
97
+ userId: string;
98
+ }) => Promise<{
99
+ data: null;
100
+ error: {
101
+ message?: string | undefined;
102
+ status: number;
103
+ statusText: string;
104
+ };
105
+ } | {
106
+ data: UserSignInSecurity;
107
+ error: null;
108
+ }>;
109
+ unlock: (data: {
110
+ userId: string;
111
+ }) => Promise<{
112
+ data: null;
113
+ error: {
114
+ message?: string | undefined;
115
+ status: number;
116
+ statusText: string;
117
+ };
118
+ } | {
119
+ data: {
120
+ status: boolean;
121
+ };
122
+ error: null;
123
+ }>;
124
+ removePasskey: (data: {
125
+ userId: string;
126
+ passkeyId: string;
127
+ }) => Promise<{
128
+ data: null;
129
+ error: {
130
+ message?: string | undefined;
131
+ status: number;
132
+ statusText: string;
133
+ };
134
+ } | {
135
+ data: {
136
+ status: boolean;
137
+ };
138
+ error: null;
139
+ }>;
140
+ forgetTrustedDevices: (data: {
141
+ userId: string;
142
+ }) => Promise<{
143
+ data: null;
144
+ error: {
145
+ message?: string | undefined;
146
+ status: number;
147
+ statusText: string;
148
+ };
149
+ } | {
150
+ data: {
151
+ status: boolean;
152
+ };
153
+ error: null;
154
+ }>;
55
155
  };
56
156
  };
57
157
  pathMethods: {
58
158
  '/two-factor-policy/reset': "POST";
159
+ '/two-factor-policy/unlock': "POST";
160
+ '/two-factor-policy/remove-passkey': "POST";
161
+ '/two-factor-policy/forget-trusted-devices': "POST";
59
162
  };
60
163
  };
@@ -1,5 +1,6 @@
1
1
  import { BetterAuthPlugin } from 'better-auth';
2
2
  import { createAuthMiddleware } from 'better-auth/api';
3
+ import { symmetricDecrypt } from 'better-auth/crypto';
3
4
  import { TwoFactorChange } from 'email';
4
5
  /**
5
6
  * Carries the challenge for a client that cannot hold the cookie: the widget,
@@ -9,6 +10,14 @@ import { TwoFactorChange } from 'email';
9
10
  export declare const TWO_FACTOR_TOKEN_HEADER = "x-two-factor-token";
10
11
  /** Time the code sent by email stays valid, in minutes. */
11
12
  export declare const TWO_FACTOR_OTP_PERIOD_MINUTES = 5;
13
+ export type TwoFactorRow = {
14
+ id: string;
15
+ userId: string;
16
+ backupCodes: string;
17
+ verified?: boolean | null;
18
+ failedVerificationCount?: number | null;
19
+ lockedUntil?: Date | string | null;
20
+ };
12
21
  type ChangedUser = {
13
22
  id: string;
14
23
  email: string;
@@ -21,6 +30,37 @@ export type MiddlewareContext = Parameters<Parameters<typeof createAuthMiddlewar
21
30
  * written.
22
31
  */
23
32
  export declare function announceTwoFactorChange(user: ChangedUser, change: TwoFactorChange): Promise<void>;
33
+ /**
34
+ * The verification rows that remember a device on which the user chose to
35
+ * skip the code: the `twoFactor` plugin names them `trust-device-<id>` and
36
+ * stores the user id as their value.
37
+ */
38
+ export declare function trustedDeviceWhere(userId: string): ({
39
+ field: string;
40
+ value: string;
41
+ operator?: undefined;
42
+ } | {
43
+ field: string;
44
+ operator: "starts_with";
45
+ value: string;
46
+ })[];
47
+ /**
48
+ * Forgets every device on which the user chose to skip the code. They are
49
+ * verification rows holding the user id: left in place, one would skip the
50
+ * code once the factor is on again, on a device that may be the lost one.
51
+ * The plugin itself forgets only the device the factor is turned off from.
52
+ */
53
+ export declare function forgetTrustedDevices(adapter: MiddlewareContext['context']['adapter'], userId: string): Promise<number>;
54
+ /**
55
+ * How many recovery codes the user has left, or null when it cannot be told.
56
+ * better-auth keeps them encrypted with its secret, so only the count leaves
57
+ * this function, never a code.
58
+ */
59
+ export declare function countBackupCodes(ctx: {
60
+ context: {
61
+ secretConfig: Parameters<typeof symmetricDecrypt>[0]['key'];
62
+ };
63
+ }, row: Pick<TwoFactorRow, 'backupCodes'>): Promise<number | null>;
24
64
  type PolicyOrganization = {
25
65
  requireTwoFactor?: boolean | null;
26
66
  deleted?: boolean | null;
@@ -54,8 +94,9 @@ export declare function isTwoFactorSetupRequiredForSession(input: {
54
94
  organizations: readonly PolicyOrganization[] | (() => Promise<readonly PolicyOrganization[]>);
55
95
  }): Promise<boolean>;
56
96
  /**
57
- * The status endpoint, the administrator reset, the widget bridge and the
58
- * announcements of docs/specs/two-factor-authentication.md.
97
+ * The status endpoint, the widget bridge and the announcements of
98
+ * docs/specs/two-factor-authentication.md. The administrator's endpoints are
99
+ * in two-factor-admin-plugin.ts.
59
100
  *
60
101
  * The endpoints live under `/two-factor-policy/` and not `/two-factor/` on
61
102
  * purpose: the `twoFactor` plugin rate limits its prefix to three requests
@@ -118,6 +118,8 @@ declare const WebDocumentSourceSchema: z.ZodObject<{
118
118
  extractionInputHash: z.ZodOptional<z.ZodString>;
119
119
  finalUrl: z.ZodOptional<z.ZodString>;
120
120
  sourceId: z.ZodOptional<z.ZodUUID>;
121
+ lastSyncedAt: z.ZodOptional<z.ZodString>;
122
+ lastmod: z.ZodOptional<z.ZodString>;
121
123
  }, z.core.$strip>;
122
124
  /**
123
125
  * `metadata.source`, discriminated on `provider`.
@@ -149,6 +151,8 @@ export declare const DocumentSourceSchema: z.ZodPreprocess<z.ZodDiscriminatedUni
149
151
  extractionInputHash: z.ZodOptional<z.ZodString>;
150
152
  finalUrl: z.ZodOptional<z.ZodString>;
151
153
  sourceId: z.ZodOptional<z.ZodUUID>;
154
+ lastSyncedAt: z.ZodOptional<z.ZodString>;
155
+ lastmod: z.ZodOptional<z.ZodString>;
152
156
  }, z.core.$strip>, z.ZodObject<{
153
157
  contentHash: z.ZodOptional<z.ZodString>;
154
158
  lastRefresh: z.ZodOptional<z.ZodObject<{
@@ -424,6 +428,14 @@ export interface DocumentProcessingJob {
424
428
  * that really did get shorter, so the guard would only stand in their way.
425
429
  */
426
430
  guarded?: boolean;
431
+ /**
432
+ * The web source whose sitemap asked for this early refresh. Nobody is
433
+ * watching it either, so it enforces the shrink guard; and it is void if
434
+ * the page no longer belongs to that source, which is what editing its text
435
+ * by hand does. Not `guarded`, which also voids a page without a trigger:
436
+ * a source reads its pages whether they have one or not.
437
+ */
438
+ sourceId?: string;
427
439
  }
428
440
  /**
429
441
  * Metadata structure for document.metadata column
@@ -447,6 +459,8 @@ export declare const DocumentMetadataSchema: z.ZodObject<{
447
459
  extractionInputHash: z.ZodOptional<z.ZodString>;
448
460
  finalUrl: z.ZodOptional<z.ZodString>;
449
461
  sourceId: z.ZodOptional<z.ZodUUID>;
462
+ lastSyncedAt: z.ZodOptional<z.ZodString>;
463
+ lastmod: z.ZodOptional<z.ZodString>;
450
464
  }, z.core.$strip>, z.ZodObject<{
451
465
  contentHash: z.ZodOptional<z.ZodString>;
452
466
  lastRefresh: z.ZodOptional<z.ZodObject<{
@@ -883,6 +897,8 @@ export declare const DocumentSchema: z.ZodObject<{
883
897
  extractionInputHash: z.ZodOptional<z.ZodString>;
884
898
  finalUrl: z.ZodOptional<z.ZodString>;
885
899
  sourceId: z.ZodOptional<z.ZodUUID>;
900
+ lastSyncedAt: z.ZodOptional<z.ZodString>;
901
+ lastmod: z.ZodOptional<z.ZodString>;
886
902
  }, z.core.$strip>, z.ZodObject<{
887
903
  contentHash: z.ZodOptional<z.ZodString>;
888
904
  lastRefresh: z.ZodOptional<z.ZodObject<{
@@ -1426,6 +1442,7 @@ export declare const DocumentCreateDtoSchema: z.ZodObject<{
1426
1442
  pages: z.ZodOptional<z.ZodString>;
1427
1443
  priority: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
1428
1444
  refreshInterval: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof DocumentRefreshInterval>>>;
1445
+ syncSourceId: z.ZodOptional<z.ZodUUID>;
1429
1446
  }, z.core.$strip>;
1430
1447
  /**
1431
1448
  * Document update schema for PUT /documents/:id endpoint
@@ -39,6 +39,16 @@ export type DocumentFolder = z.infer<typeof DocumentFolderSchema>;
39
39
  * business, which is why it reads the first segment and stops.
40
40
  */
41
41
  export declare function documentFolderProvider(folder: Pick<DocumentFolder, 'externalId'>): DocumentSourceProvider | undefined;
42
+ /**
43
+ * Whether a folder is read-only because a source that owns its documents
44
+ * fills it.
45
+ *
46
+ * Not the same question as `documentFolderProvider`: a web source's folder has
47
+ * a provider, and an icon and a badge that say so, but its pages stay editable
48
+ * and anything can be added to it. The backend answers the same question with
49
+ * `owningSourceCondition`, from the same policy.
50
+ */
51
+ export declare function documentFolderIsReadOnly(folder: Pick<DocumentFolder, 'externalId'>): boolean;
42
52
  export type DocumentFolderCreateDto = z.infer<typeof DocumentFolderCreateDtoSchema>;
43
53
  export type DocumentFolderUpdateDto = z.infer<typeof DocumentFolderUpdateDtoSchema>;
44
54
  export type DocumentFolderQuerystring = z.infer<typeof DocumentFolderQuerystringSchema>;
@@ -1,5 +1,32 @@
1
- import { DocumentSourceProvider } from './Document';
1
+ import { DocumentRefreshInterval, DocumentSourceProvider } from './Document';
2
2
  import * as z from 'zod';
3
+ /**
4
+ * What a provider's sources do with the documents they bring in.
5
+ *
6
+ * - `materialize`: `download` stores the remote file in a blob and makes a
7
+ * `file` document of it; `url` makes a `url` document and leaves the reading
8
+ * to the processor, so there is nothing to download.
9
+ * - `ownsDocuments`: true makes the source's folder read-only and propagates
10
+ * remote deletions; false only discovers, and the documents stay as
11
+ * editable as anything a person imported.
12
+ *
13
+ * These two values are everything the backend, the sync function and the
14
+ * interface read to decide how a document is created and whether it can be
15
+ * touched by hand. A web source that removes the pages leaving its sitemap does
16
+ * so through an option of that source, not by owning its documents.
17
+ */
18
+ export interface DocumentSourcePolicy {
19
+ materialize: 'download' | 'url';
20
+ ownsDocuments: boolean;
21
+ }
22
+ export declare const DOCUMENT_SOURCE_POLICIES: Record<DocumentSourceProvider, DocumentSourcePolicy>;
23
+ /**
24
+ * Whether a provider's sources govern their documents.
25
+ *
26
+ * An unknown provider counts as owning: the mistake in that direction makes a
27
+ * folder read-only, the other one lets people edit what a job will overwrite.
28
+ */
29
+ export declare function sourceOwnsDocuments(provider: string): boolean;
3
30
  /**
4
31
  * How often a source is checked.
5
32
  *
@@ -96,8 +123,42 @@ export declare const DocumentSyncRunStatsSchema: z.ZodObject<{
96
123
  skippedUnsupported: z.ZodDefault<z.ZodNumber>;
97
124
  skippedTooLarge: z.ZodDefault<z.ZodNumber>;
98
125
  failed: z.ZodDefault<z.ZodNumber>;
126
+ capped: z.ZodDefault<z.ZodNumber>;
127
+ removalHeld: z.ZodDefault<z.ZodNumber>;
99
128
  }, z.core.$strip>;
100
129
  export type DocumentSyncRunStats = z.infer<typeof DocumentSyncRunStatsSchema>;
130
+ /**
131
+ * Where a web source reads its pages: a sitemap, or a walk from one page.
132
+ *
133
+ * The same fields as the crawler dialog's two modes, because the source is
134
+ * that dialog's parameters saved.
135
+ */
136
+ export declare const WebSourceRemoteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ sitemapUrl: z.ZodURL;
138
+ kind: z.ZodLiteral<"sitemap">;
139
+ }, z.core.$strip>, z.ZodObject<{
140
+ startUrl: z.ZodURL;
141
+ maxPages: z.ZodDefault<z.ZodNumber>;
142
+ maxDepth: z.ZodDefault<z.ZodNumber>;
143
+ followExternal: z.ZodDefault<z.ZodBoolean>;
144
+ kind: z.ZodLiteral<"depth">;
145
+ }, z.core.$strip>], "kind">;
146
+ export type WebSourceRemote = z.infer<typeof WebSourceRemoteSchema>;
147
+ /**
148
+ * The keys of a web source's `options` that are about the source rather than
149
+ * about converting a page. Everything else in `options` is conversion options,
150
+ * handed to the processor as they are.
151
+ */
152
+ export declare const WebSourceOptionsSchema: z.ZodObject<{
153
+ refreshInterval: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof DocumentRefreshInterval>>>;
154
+ removeMissing: z.ZodOptional<z.ZodBoolean>;
155
+ confirmedRemovals: z.ZodOptional<z.ZodNumber>;
156
+ }, z.core.$loose>;
157
+ export type WebSourceOptions = z.infer<typeof WebSourceOptionsSchema>;
158
+ /** The `options` keys that never reach the processor as conversion options. */
159
+ export declare const WEB_SOURCE_OWN_OPTION_KEYS: readonly ["refreshInterval", "removeMissing", "confirmedRemovals"];
160
+ /** The URL a web source reads, whichever mode it is in. */
161
+ export declare function webSourceUrl(remote: Record<string, unknown>): string;
101
162
  export declare const DocumentSyncSourceSchema: z.ZodObject<{
102
163
  id: z.ZodUUID;
103
164
  organizationId: z.ZodUUID;
@@ -123,6 +184,8 @@ export declare const DocumentSyncSourceSchema: z.ZodObject<{
123
184
  skippedUnsupported: z.ZodDefault<z.ZodNumber>;
124
185
  skippedTooLarge: z.ZodDefault<z.ZodNumber>;
125
186
  failed: z.ZodDefault<z.ZodNumber>;
187
+ capped: z.ZodDefault<z.ZodNumber>;
188
+ removalHeld: z.ZodDefault<z.ZodNumber>;
126
189
  }, z.core.$strip>>;
127
190
  lastSyncAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
128
191
  lastError: z.ZodNullable<z.ZodString>;
@@ -149,13 +212,20 @@ export declare const DocumentSyncSourceCreateDtoSchema: z.ZodObject<{
149
212
  remote: z.ZodRecord<z.ZodString, z.ZodUnknown>;
150
213
  interval: z.ZodDefault<z.ZodEnum<typeof DocumentSyncInterval>>;
151
214
  options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
215
+ deferFirstRun: z.ZodOptional<z.ZodBoolean>;
152
216
  }, z.core.$strip>;
153
217
  export type DocumentSyncSourceCreateDto = z.infer<typeof DocumentSyncSourceCreateDtoSchema>;
154
218
  export declare const DocumentSyncSourceUpdateDtoSchema: z.ZodObject<{
155
219
  interval: z.ZodOptional<z.ZodEnum<typeof DocumentSyncInterval>>;
156
220
  enabled: z.ZodOptional<z.ZodBoolean>;
221
+ removeMissing: z.ZodOptional<z.ZodBoolean>;
157
222
  }, z.core.$strip>;
158
223
  export type DocumentSyncSourceUpdateDto = z.infer<typeof DocumentSyncSourceUpdateDtoSchema>;
224
+ /** "Sync now", optionally approving the removal the last run held back. */
225
+ export declare const DocumentSyncSourceSyncDtoSchema: z.ZodObject<{
226
+ confirmRemovals: z.ZodOptional<z.ZodNumber>;
227
+ }, z.core.$strip>;
228
+ export type DocumentSyncSourceSyncDto = z.infer<typeof DocumentSyncSourceSyncDtoSchema>;
159
229
  export declare const DocumentSyncSourceQuerystringSchema: z.ZodObject<{
160
230
  agentId: z.ZodUUID;
161
231
  }, z.core.$strip>;
@@ -9,7 +9,7 @@ export declare const LeadSchema: z.ZodObject<{
9
9
  phone: z.ZodNullable<z.ZodString>;
10
10
  agentId: z.ZodString;
11
11
  organizationId: z.ZodString;
12
- chatId: z.ZodString;
12
+ chatId: z.ZodNullable<z.ZodString>;
13
13
  metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
14
  createdAt: z.ZodCoercedDate<unknown>;
15
15
  createdBy: z.ZodString;
@@ -122,6 +122,13 @@ export declare const MemberSchema: z.ZodObject<{
122
122
  twoFactorEnabled: z.ZodOptional<z.ZodBoolean>;
123
123
  hasPassword: z.ZodOptional<z.ZodBoolean>;
124
124
  hasPasskey: z.ZodOptional<z.ZodBoolean>;
125
+ signInSecurity: z.ZodOptional<z.ZodEnum<{
126
+ required: "required";
127
+ none: "none";
128
+ totp: "totp";
129
+ otp: "otp";
130
+ passkey: "passkey";
131
+ }>>;
125
132
  }, z.core.$strip>;
126
133
  }, z.core.$strip>;
127
134
  export type Member = z.infer<typeof MemberSchema>;
@@ -8,11 +8,40 @@ export declare const NotificationType: {
8
8
  readonly TwoFactor: "two_factor";
9
9
  /** A sync took documents out because the remote no longer has them. */
10
10
  readonly DocumentSyncRemoved: "document_sync_removed";
11
+ /** A web source took out pages its sitemap no longer lists. */
12
+ readonly WebSourcePagesRemoved: "web_source_pages_removed";
13
+ /** A web source held back a removal too large to trust without a person. */
14
+ readonly WebSourceRemovalHeld: "web_source_removal_held";
11
15
  readonly ChatWarning: "chat_warning";
12
16
  readonly ChatBlocked: "chat_blocked";
13
17
  readonly Generic: "generic";
14
18
  };
15
19
  export type NotificationType = (typeof NotificationType)[keyof typeof NotificationType];
20
+ /**
21
+ * Group key of the admins' notification about a flagged conversation: one row
22
+ * per chat and admin, bumped by every later analysis of that chat.
23
+ */
24
+ export declare const chatAnalysisNotificationGroupKey: (chatId: string) => string;
25
+ /**
26
+ * Title of the admins' notification about a flagged conversation. It tells a
27
+ * block from a warning on a stored row better than `type` does: a group bump
28
+ * rewrites the title, the body and the metadata, never the type, so a chat
29
+ * warned first and blocked later keeps `type = chat_warning`.
30
+ */
31
+ export declare const chatAnalysisNotificationTitle: (blocked: boolean) => string;
32
+ /**
33
+ * Body of the admins' notification about a flagged conversation
34
+ * (`chat_warning` or `chat_blocked`). The writer quotes the chat's title; the
35
+ * GDPR erasure (`eraseConversationRows`) rebuilds the body without it, from the
36
+ * same sentences, so the notification and its link to the chat survive with
37
+ * nothing the user wrote. Migration `erase_chat_residuals` holds a SQL copy
38
+ * of these sentences for the rows erased before it.
39
+ */
40
+ export declare function chatAnalysisNotificationBody({ blocked, riskScore, chatTitle, }: {
41
+ blocked: boolean;
42
+ riskScore?: number;
43
+ chatTitle?: string;
44
+ }): string;
16
45
  export declare const NotificationSchema: z.ZodObject<{
17
46
  id: z.ZodString;
18
47
  organizationId: z.ZodNullable<z.ZodString>;
@@ -222,6 +222,16 @@ export declare const OrganizationRetentionPolicySchema: z.ZodObject<{
222
222
  anonymousRetentionDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
223
223
  }, z.core.$strip>;
224
224
  export type OrganizationRetentionPolicy = z.infer<typeof OrganizationRetentionPolicySchema>;
225
+ /**
226
+ * Per-organization limits an operator sets from the system panel, persisted
227
+ * inside the `organization.metadata` text column. `members` counts every
228
+ * member, the ones the widget's external login brings in included; absent or
229
+ * `null` means no limit.
230
+ */
231
+ export declare const OrganizationLimitsSchema: z.ZodObject<{
232
+ members: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
233
+ }, z.core.$strip>;
234
+ export type OrganizationLimits = z.infer<typeof OrganizationLimitsSchema>;
225
235
  /**
226
236
  * Product features an operator can switch on or off per organization from the
227
237
  * system panel. A feature is listed here when a contract can plausibly exclude
@@ -358,6 +368,9 @@ export declare const OrganizationMetadataSchema: z.ZodObject<{
358
368
  utilityModel: z.ZodOptional<z.ZodString>;
359
369
  disabledGatewayModels: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString>>>;
360
370
  }, z.core.$strip>>>;
371
+ limits: z.ZodCatch<z.ZodOptional<z.ZodObject<{
372
+ members: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
373
+ }, z.core.$strip>>>;
361
374
  }, z.core.$loose>;
362
375
  export type OrganizationMetadata = z.infer<typeof OrganizationMetadataSchema>;
363
376
  /**
@@ -382,6 +395,12 @@ export declare function parseOrganizationMetadata(metadata: string | Record<stri
382
395
  * malformed metadata resolves to the platform defaults instead of failing.
383
396
  */
384
397
  export declare function resolveOrganizationFeatures(metadata: string | Record<string, unknown> | null | undefined): OrganizationFeatures;
398
+ /**
399
+ * The most members an organization may hold, from its raw `metadata` value,
400
+ * or `null` when it sets no limit. A malformed value reads as no limit, so a
401
+ * bad write can never lock an organization out of adding people.
402
+ */
403
+ export declare function resolveOrganizationMemberLimit(metadata: string | Record<string, unknown> | null | undefined): number | null;
385
404
  export declare const OrganizationPublicSchema: z.ZodObject<{
386
405
  id: z.ZodString;
387
406
  name: z.ZodString;