@dyrected/core 2.11.0 → 2.13.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.
@@ -0,0 +1,10 @@
1
+ import {
2
+ isAccessAllowed,
3
+ resolveAccess
4
+ } from "./chunk-HRRJ3RYT.js";
5
+ import "./chunk-27YRIGK5.js";
6
+ import "./chunk-JSBRDJBE.js";
7
+ export {
8
+ isAccessAllowed,
9
+ resolveAccess
10
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ AI_ACTIONS_COLLECTION,
3
+ AI_AUDIT_COLLECTION,
4
+ AI_CHUNKS_COLLECTION,
5
+ AI_MESSAGES_COLLECTION,
6
+ AI_THREADS_COLLECTION,
7
+ isAICollection
8
+ } from "./chunk-4RAQJVJM.js";
9
+ import "./chunk-JSBRDJBE.js";
10
+ export {
11
+ AI_ACTIONS_COLLECTION,
12
+ AI_AUDIT_COLLECTION,
13
+ AI_CHUNKS_COLLECTION,
14
+ AI_MESSAGES_COLLECTION,
15
+ AI_THREADS_COLLECTION,
16
+ isAICollection
17
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createDyrectedAITools,
3
+ validatePayloadAgainstFields
4
+ } from "./chunk-W7GKJM2X.js";
5
+ import "./chunk-ZYYDTHF3.js";
6
+ import "./chunk-254THFDS.js";
7
+ import "./chunk-4RAQJVJM.js";
8
+ import "./chunk-HRRJ3RYT.js";
9
+ import "./chunk-27YRIGK5.js";
10
+ import "./chunk-JSBRDJBE.js";
11
+ export {
12
+ createDyrectedAITools,
13
+ validatePayloadAgainstFields
14
+ };
@@ -1,5 +1,11 @@
1
- import { icons } from 'lucide-react';
1
+ import * as hono_types from 'hono/types';
2
+ import { Context, Hono } from 'hono';
2
3
  import { LoggerOptions, DestinationStream, Logger } from 'pino';
4
+ import { icons } from 'lucide-react';
5
+ import { z } from 'zod';
6
+ import { JWTPayload } from 'jose';
7
+ import { Tracer, Counter, Attributes, Histogram, Span } from '@opentelemetry/api';
8
+ import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
3
9
 
4
10
  /**
5
11
  * Minimum HTTP request context passed to every server-side hook and resolver.
@@ -136,12 +142,15 @@ interface PaginatedResult<T = Record<string, any>> {
136
142
  */
137
143
  interface FileData {
138
144
  filename: string;
145
+ originalFilename?: string;
139
146
  filesize?: number;
140
147
  mimeType: string;
141
148
  /** Public URL of the stored file. */
142
149
  url: string;
143
150
  width?: number;
144
151
  height?: number;
152
+ aspectRatio?: number;
153
+ folderId?: string | null;
145
154
  focalPoint?: {
146
155
  x: number;
147
156
  y: number;
@@ -152,8 +161,290 @@ interface FileData {
152
161
  type?: "upload" | "external";
153
162
  provider?: string;
154
163
  provider_metadata?: unknown;
164
+ metadata?: Record<string, unknown>;
165
+ [key: string]: unknown;
166
+ }
167
+
168
+ interface AIThread {
169
+ id: string;
170
+ projectId: string;
171
+ userId: string;
172
+ title?: string;
173
+ summary?: string;
174
+ createdAt: Date | string;
175
+ updatedAt: Date | string;
176
+ [key: string]: unknown;
177
+ }
178
+ interface AIMessage {
179
+ id: string;
180
+ threadId: string;
181
+ role: 'user' | 'assistant' | 'system';
182
+ content: string;
183
+ parts?: any[];
184
+ createdAt: Date | string;
185
+ metadata?: Record<string, unknown>;
186
+ [key: string]: unknown;
187
+ }
188
+ interface DyrectedAIContext {
189
+ project: {
190
+ name: string;
191
+ id: string;
192
+ };
193
+ globalPrompt?: string;
194
+ collections: Array<{
195
+ slug: string;
196
+ label?: string;
197
+ prompt?: string;
198
+ fields?: Array<{
199
+ name: string;
200
+ type: string;
201
+ required?: boolean;
202
+ }>;
203
+ }>;
204
+ globals: Array<{
205
+ slug: string;
206
+ label?: string;
207
+ prompt?: string;
208
+ }>;
209
+ user: {
210
+ name?: string;
211
+ role?: string;
212
+ };
213
+ }
214
+ interface AIToolContext {
215
+ db: any;
216
+ user?: any;
217
+ projectId?: string;
218
+ config?: any;
219
+ }
220
+ interface AIToolDefinition<TParams = any, TResult = any> {
221
+ description: string;
222
+ inputSchema?: z.ZodType<TParams>;
223
+ parameters?: z.ZodType<TParams>;
224
+ execute: (args: TParams, context: AIToolContext) => Promise<TResult> | TResult;
225
+ }
226
+ interface GlobalRAGConfig {
227
+ /** Enable or disable automatic RAG indexing globally. Defaults to true. */
228
+ enabled?: boolean;
229
+ /** Embedding model identifier. Defaults to 'text-embedding-004' (Google) or 'text-embedding-3-small' (OpenAI/AgentRouter). */
230
+ embeddingModel?: string;
231
+ /** Default character budget per chunk. Defaults to 1500 (~375-500 tokens). */
232
+ maxChunkSize?: number;
233
+ /** Default character overlap between chunks. Defaults to 150. */
234
+ chunkOverlap?: number;
235
+ /** Default minimum cosine similarity score threshold (0.0 to 1.0). Defaults to 0.45. */
236
+ minScore?: number;
237
+ /** Default number of top snippets to retrieve. Defaults to 4. */
238
+ topK?: number;
239
+ }
240
+ interface CollectionRAGConfig {
241
+ /** Enable or disable RAG indexing for this collection. Defaults to true. */
242
+ enabled?: boolean;
243
+ /** Whitelist of specific field names to index. Defaults to all text/richText/textarea fields. */
244
+ fields?: string[];
245
+ /** Field to use for citation display titles (e.g. 'title', 'name', 'question'). */
246
+ titleField?: string;
247
+ /** Custom character budget per chunk for this collection. */
248
+ maxChunkSize?: number;
249
+ /** Custom character overlap between chunks for this collection. */
250
+ chunkOverlap?: number;
251
+ }
252
+ interface AIChunk {
253
+ id: string;
254
+ projectId: string;
255
+ collection: string;
256
+ documentId: string;
257
+ field: string;
258
+ chunkIndex: number;
259
+ text: string;
260
+ embedding: number[];
261
+ tokenCount: number;
262
+ contentHash: string;
263
+ metadata?: {
264
+ title?: string;
265
+ slug?: string;
266
+ locale?: string;
267
+ status?: string;
268
+ updatedAt?: Date | string;
269
+ [key: string]: unknown;
270
+ };
271
+ createdAt: Date | string;
272
+ updatedAt: Date | string;
273
+ [key: string]: unknown;
274
+ }
275
+ interface RAGSearchResult {
276
+ id: string;
277
+ collection: string;
278
+ documentId: string;
279
+ title: string;
280
+ field: string;
281
+ score: number;
282
+ text: string;
283
+ url: string;
284
+ metadata?: Record<string, unknown>;
285
+ }
286
+ interface AIRateLimitResult {
287
+ allowed: boolean;
288
+ remaining: number;
289
+ resetTimeSec: number;
290
+ retryAfter?: number;
291
+ }
292
+ interface AIRateLimitStore {
293
+ consume(key: string, limit: number, windowMs: number): Promise<AIRateLimitResult> | AIRateLimitResult;
294
+ }
295
+ interface AIConfig {
296
+ /** Master switch to enable/disable AI endpoints. Defaults to true. */
297
+ enabled?: boolean;
298
+ /** AI Provider to use. Defaults to 'google' or auto-detects from environment variables. */
299
+ provider?: 'google' | 'agentrouter' | 'openrouter' | 'openai' | 'custom';
300
+ /** Custom base URL for OpenAI-compatible gateways (e.g. https://agentrouter.org/v1). */
301
+ baseURL?: string;
302
+ /** Optional custom API key (or read from environment variables). */
303
+ apiKey?: string;
304
+ /** Global system prompt / brand persona instructions for the project. */
305
+ systemPrompt?: string;
306
+ /** Model to use for AI assistant. Defaults to 'gemini-2.0-flash' for Google or 'claude-3-haiku-20240307' for AgentRouter. */
307
+ model?: string;
308
+ /** Fallback model to use if primary model hits rate limits. */
309
+ fallbackModel?: string;
310
+ /** Maximum number of sequential tool execution steps per user message. Defaults to 5. */
311
+ maxSteps?: number;
312
+ /** Number of automatic retry attempts on transient rate limits / network errors. Defaults to 3. */
313
+ maxRetries?: number;
314
+ /** Rate limiting options per user and per project. */
315
+ rateLimit?: {
316
+ userMax?: number;
317
+ projectMax?: number;
318
+ store?: AIRateLimitStore;
319
+ };
320
+ /** Global RAG (Retrieval-Augmented Generation) configuration options. */
321
+ rag?: GlobalRAGConfig;
322
+ /** Conversation compaction options. */
323
+ compaction?: {
324
+ enabled?: boolean;
325
+ maxMessages?: number;
326
+ recentMessagesCount?: number;
327
+ };
328
+ /** Automated PII redaction and de-identification settings. */
329
+ pii?: AIPIIConfig;
330
+ /** Custom developer-defined tools. */
331
+ tools?: Record<string, AIToolDefinition>;
332
+ }
333
+ type AIPIIPattern = "email" | "phone" | "phone_number" | "phoneNumber" | "ssn" | "credit_card" | "ipv4" | "ipv6" | "iban" | "api_key" | "jwt" | "passport";
334
+ interface AIPIIConfig {
335
+ /** If true, automatically scrubs known PII from unstructured text before AI embedding or inference. */
336
+ enabled?: boolean;
337
+ /** Patterns to scrub. Defaults to ['email', 'phone', 'ssn', 'credit_card', 'ipv4']. */
338
+ patterns?: AIPIIPattern[];
339
+ /** Redaction strategy: 'mask' (e.g. b***@example.com) or 'token' (e.g. [REDACTED_EMAIL]). Defaults to 'mask'. */
340
+ strategy?: 'mask' | 'token';
341
+ /** Optional custom scrubber function to transform text before AI consumption. */
342
+ customScrubber?: (text: string) => string;
343
+ }
344
+ interface CollectionSummaryResult {
345
+ slug: string;
346
+ label: string;
347
+ auth: boolean;
348
+ timestamps: boolean;
349
+ }
350
+ interface CollectionSchemaResult {
351
+ slug: string;
352
+ label: string;
353
+ auth: boolean;
354
+ fields: Array<{
355
+ name: string;
356
+ type: string;
357
+ label?: string;
358
+ required: boolean;
359
+ unique: boolean;
360
+ relationTo?: string;
361
+ options?: any;
362
+ }>;
363
+ }
364
+ interface GlobalSummaryResult {
365
+ slug: string;
366
+ label: string;
367
+ }
368
+ interface GlobalSchemaResult {
369
+ slug: string;
370
+ label: string;
371
+ fields: Array<{
372
+ name: string;
373
+ type: string;
374
+ label?: string;
375
+ required: boolean;
376
+ }>;
377
+ data: Record<string, unknown> | null;
378
+ }
379
+ interface QueryCollectionResult {
380
+ collection: string;
381
+ docs: Array<Record<string, unknown>>;
382
+ total: number;
383
+ totalPages: number;
384
+ page: number;
385
+ limit: number;
386
+ }
387
+ interface GetDocumentResult {
388
+ collection: string;
389
+ doc: Record<string, unknown>;
390
+ }
391
+ interface AggregateCollectionResult {
392
+ collection: string;
393
+ result: Record<string, unknown>;
394
+ }
395
+ type AIActionType = 'createDocument' | 'updateDocument' | 'deleteDocument' | 'updateGlobal';
396
+ type AIActionStatus = 'pending' | 'approved' | 'rejected' | 'executed' | 'failed';
397
+ interface AIAction {
398
+ id: string;
399
+ projectId: string;
400
+ threadId?: string;
401
+ userId?: string;
402
+ type: AIActionType;
403
+ targetCollection?: string;
404
+ targetGlobal?: string;
405
+ documentId?: string;
406
+ summary: string;
407
+ beforeSnapshot?: Record<string, unknown> | null;
408
+ proposedData: Record<string, unknown>;
409
+ status: AIActionStatus;
410
+ errorMessage?: string;
411
+ expiresAt: Date | string;
412
+ createdAt: Date | string;
413
+ executedAt?: Date | string;
155
414
  [key: string]: unknown;
156
415
  }
416
+ type AIAuditActionType = AIActionType | 'chat_turn' | 'rag_search' | 'action_rejected';
417
+ interface AIAuditRecord {
418
+ id: string;
419
+ projectId: string;
420
+ actionId?: string;
421
+ threadId?: string;
422
+ executedBy?: string;
423
+ actionType: AIAuditActionType;
424
+ target: string;
425
+ snapshotBefore?: Record<string, unknown> | null;
426
+ snapshotAfter?: Record<string, unknown> | null;
427
+ rollbackPayload?: Record<string, unknown> | null;
428
+ tokens?: {
429
+ promptTokens?: number;
430
+ completionTokens?: number;
431
+ totalTokens?: number;
432
+ };
433
+ estimatedCostUsd?: number;
434
+ latencyMs?: {
435
+ total?: number;
436
+ retrieval?: number;
437
+ generation?: number;
438
+ };
439
+ createdAt: Date | string;
440
+ [key: string]: unknown;
441
+ }
442
+ declare const AI_THREADS_COLLECTION = "_dyrected_ai_threads";
443
+ declare const AI_MESSAGES_COLLECTION = "_dyrected_ai_messages";
444
+ declare const AI_CHUNKS_COLLECTION = "_dyrected_ai_chunks";
445
+ declare const AI_ACTIONS_COLLECTION = "_dyrected_ai_actions";
446
+ declare const AI_AUDIT_COLLECTION = "_dyrected_ai_audit";
447
+ declare function isAICollection(slug: string): boolean;
157
448
 
158
449
  /** A valid icon component name from the Lucide icon set bundled with Dyrected Admin. */
159
450
  type AdminIconName = keyof typeof icons;
@@ -1739,6 +2030,21 @@ interface CollectionConfig<TDoc extends object = Record<string, unknown>> {
1739
2030
  */
1740
2031
  urlPattern?: string;
1741
2032
  };
2033
+ /**
2034
+ * Optional custom AI assistant instructions and RAG indexing options for this collection.
2035
+ */
2036
+ ai?: {
2037
+ /** Specific editorial guidelines, brand voice, or instructions for this collection. */
2038
+ prompt?: string;
2039
+ /** Collection-level RAG (Retrieval-Augmented Generation) indexing settings. */
2040
+ rag?: CollectionRAGConfig;
2041
+ /** Field names to completely omit from AI context and RAG indexing. */
2042
+ excludeFields?: string[];
2043
+ /** Field names to mask (e.g. j***@example.com) before sending to AI. */
2044
+ redactFields?: string[];
2045
+ /** Custom hook to transform/sanitize/pseudonymize documents before AI inspection. */
2046
+ sanitizeDoc?: (doc: Record<string, unknown>) => Record<string, unknown>;
2047
+ };
1742
2048
  /**
1743
2049
  * Detail view layout configuration for the Admin UI.
1744
2050
  *
@@ -1884,6 +2190,13 @@ interface GlobalConfig<TDoc extends object = Record<string, unknown>> {
1884
2190
  /** If `true`, this global is not shown in the Admin UI sidebar. */
1885
2191
  hidden?: boolean;
1886
2192
  };
2193
+ /**
2194
+ * Optional custom AI assistant instructions for this global singleton.
2195
+ */
2196
+ ai?: {
2197
+ /** Specific guidelines, context, or instructions when interacting with this global. */
2198
+ prompt?: string;
2199
+ };
1887
2200
  /**
1888
2201
  * Initial data to seed this global with the first time it is fetched and
1889
2202
  * found to be empty.
@@ -1992,6 +2305,39 @@ interface DatabaseAdapter {
1992
2305
  * and `afterDelete` hooks where the full {@link DatabaseAdapter} is provided.
1993
2306
  */
1994
2307
  type ReadonlyDatabaseAdapter = Pick<DatabaseAdapter, "find" | "findOne" | "getGlobal" | "aggregate">;
2308
+ /**
2309
+ * Options for dynamic on-the-fly image transformations.
2310
+ */
2311
+ interface ImageTransformOptions {
2312
+ /** Target width in pixels. */
2313
+ width?: number;
2314
+ /** Target height in pixels. */
2315
+ height?: number;
2316
+ /** Aspect ratio string (e.g. "16:9", "1:1") or numeric ratio (e.g. 1.777). */
2317
+ aspectRatio?: string | number;
2318
+ /** Crop strategy. */
2319
+ crop?: "fill" | "fit" | "limit" | "pad" | "thumb" | "scale" | "cover" | "contain";
2320
+ /** Gravity / focal anchor for cropping. */
2321
+ gravity?: "auto" | "face" | "center" | "focal" | "xy_center" | string;
2322
+ /** Explicit focal point percentage coordinates (0.0 to 1.0). */
2323
+ focalPoint?: {
2324
+ x: number;
2325
+ y: number;
2326
+ };
2327
+ /** Output quality (1-100 or 'auto'). */
2328
+ quality?: number | "auto" | "auto:best" | "auto:good" | "auto:eco";
2329
+ /** Target image format. */
2330
+ format?: "auto" | "webp" | "avif" | "png" | "jpg" | "jpeg";
2331
+ /** Blur radius for placeholders/effects. */
2332
+ blur?: number;
2333
+ /** Rotation angle in degrees (e.g. 90, 180, 270). */
2334
+ rotate?: number;
2335
+ /** Device pixel ratio multiplier. */
2336
+ dpr?: number | "auto";
2337
+ /** Named transformation preset key. */
2338
+ key?: string;
2339
+ [key: string]: unknown;
2340
+ }
1995
2341
  /**
1996
2342
  * The interface every storage adapter must implement.
1997
2343
  *
@@ -2014,9 +2360,10 @@ interface StorageAdapter {
2014
2360
  delete(args: {
2015
2361
  filename: string;
2016
2362
  }): Promise<void>;
2017
- /** Return the public URL for a stored file. */
2363
+ /** Return the public URL for a stored file, with optional dynamic transformations. */
2018
2364
  getURL(args: {
2019
2365
  filename: string;
2366
+ transform?: ImageTransformOptions;
2020
2367
  }): string;
2021
2368
  /**
2022
2369
  * Retrieve the file's raw bytes and MIME type for serving via the API.
@@ -2179,6 +2526,15 @@ interface FieldBase {
2179
2526
  renameTo?: string;
2180
2527
  /** Whether SQL adapters should promote this field into a first-class column. */
2181
2528
  promoted?: boolean;
2529
+ /** AI assistant privacy and PII redaction settings for this field. */
2530
+ ai?: {
2531
+ /** If true, completely removes this field from AI queries, RAG chunks, and context. */
2532
+ exclude?: boolean;
2533
+ /** If true or 'mask', masks the field value (e.g. b***@example.com) before sending to AI. */
2534
+ redact?: boolean | 'mask';
2535
+ /** If true, opts out of automatic default PII masking (e.g. for email/phone fields). */
2536
+ allowRaw?: boolean;
2537
+ };
2182
2538
  }
2183
2539
  interface BaseFieldAdmin {
2184
2540
  /** Placeholder text shown when the input has no value. */
@@ -2247,8 +2603,8 @@ interface FieldAdminOnChangeHookArgs<TValue = unknown> {
2247
2603
  docs?: Record<string, unknown>[];
2248
2604
  /** Current authenticated user. */
2249
2605
  user?: unknown;
2250
- /** Imperative setter for async or derived updates. */
2251
- setValue: (value: unknown) => void;
2606
+ /** Imperative setter for current field or sibling fields. */
2607
+ setValue: (nameOrVal: string | unknown, maybeVal?: unknown) => void;
2252
2608
  }
2253
2609
  type FieldAdminOnChangeHook<TValue = unknown> = (args: FieldAdminOnChangeHookArgs<TValue>) => unknown;
2254
2610
  type FieldAdminHooks<TValue> = {
@@ -2593,6 +2949,10 @@ type JoinFieldAdmin = {
2593
2949
  showCreateButton?: boolean;
2594
2950
  /** Whether the join field should show the "View all" action in the Admin UI. Defaults to `true`. */
2595
2951
  showViewButton?: boolean;
2952
+ /** Display layout for the join list: 'list' (default) or 'table'. */
2953
+ layout?: "list" | "table";
2954
+ /** Columns to display when layout is 'table'. */
2955
+ columns?: string[];
2596
2956
  };
2597
2957
  interface UrlLinkValue {
2598
2958
  /** Whether the link is a custom URL or a reference to an internal document. */
@@ -2972,6 +3332,15 @@ interface DyrectedConfig<TUser extends AuthenticatedUser = AuthenticatedUser> {
2972
3332
  * @see ImageService
2973
3333
  */
2974
3334
  image?: ImageService;
3335
+ /**
3336
+ * Media management, dynamic transformations, and transformation preset configurations.
3337
+ */
3338
+ media?: {
3339
+ /** Whether to restrict dynamic transformations to registered preset keys in production. */
3340
+ restrictTransforms?: boolean;
3341
+ /** Named transformation presets available via `?key=name`. */
3342
+ presets?: Record<string, ImageTransformOptions>;
3343
+ };
2975
3344
  /**
2976
3345
  * Runtime logger configuration. Accepts either logger options/destination or
2977
3346
  * a fully-instantiated Pino logger.
@@ -3102,6 +3471,156 @@ interface DyrectedConfig<TUser extends AuthenticatedUser = AuthenticatedUser> {
3102
3471
  admin?: AdminConfig;
3103
3472
  adminAuth?: AdminAuthConfig;
3104
3473
  }>;
3474
+ /**
3475
+ * AI Assistant and LLM tools configuration.
3476
+ */
3477
+ ai?: AIConfig;
3105
3478
  }
3106
3479
 
3107
- export { type RadioField as $, type AdminAuthConfig as A, type Block as B, type CollectionConfig as C, type DyrectedConfig as D, type DetailText as E, type Field as F, type GlobalConfig as G, type HookRequestContext as H, type DetailSchema as I, type ArrayField as J, type BlocksField as K, type LifecycleEventName as L, type BooleanField as M, type AuthConfig as N, type AccessPolicyResolver as O, type PublicAdminAuthConfig as P, type DateField as Q, type DateTimeField as R, type EmailField as S, type IconField as T, type ImageField as U, type JoinField as V, type WorkflowConfig as W, type JsonField as X, type MultiSelectField as Y, type NumberField as Z, type ObjectField as _, type DeclarativeHookExpression as a, type DistinctValuesOperation as a$, type RelationshipField as a0, type RichTextField as a1, type RowField as a2, type SelectField as a3, type TextField as a4, type TextareaField as a5, type TimeField as a6, type UrlField as a7, type AccessConfig as a8, type AccessFunction as a9, type BooleanFormat as aA, type CharacterLimitFieldAdmin as aB, type CharacterLimitFieldConfig as aC, type CollectionAfterChangeHook as aD, type CollectionAfterDeleteHook as aE, type CollectionAfterReadHook as aF, type CollectionAfterReadHookEntry as aG, type CollectionAfterTransitionHook as aH, type CollectionBeforeChangeHook as aI, type CollectionBeforeChangeHookEntry as aJ, type CollectionBeforeDeleteHook as aK, type CollectionBeforeReadHook as aL, type CollectionBeforeReadHookEntry as aM, type CollectionBeforeTransitionHook as aN, type CollectionListComponentSlots as aO, type CollectionViewComponentSlots as aP, type CountOperation as aQ, type CustomAdminAuthProvider as aR, type DatabaseAdapter as aS, type DateFieldAdmin as aT, type DateFormat as aU, type DefineActionOptions as aV, type DefineViewOptions as aW, type DetailSpan as aX, type DisplayTone as aY, type DisplayVariant as aZ, type DistinctCountOperation as a_, type AccessFunctionArgs as aa, type AccessResult as ab, type AccessRule as ac, type ActionConfig as ad, type ActionContext as ae, type ActionType as af, type AdminAuthAccessResolution as ag, type AdminAuthClaimMapping as ah, type AdminAuthMember as ai, type AdminAuthProvider as aj, type AdminAuthProviderMembersConfig as ak, type AdminAuthProvisioningMode as al, type AdminAuthResolveAccessArgs as am, type AdminAuthResolvedIdentity as an, type AdminConfig as ao, type AdminDashboardComponentSlots as ap, type AdminIconName as aq, type AggregateArgs as ar, type AggregateCastType as as, type AggregateInput as at, type AggregateOperation as au, type AggregateResult as av, type BaseAdminAuthProvider as aw, type BaseFieldAdmin as ax, type BlockVariant as ay, type BooleanFieldAdmin as az, type AuthenticatedUser as b, type TrustProxyConfig as b$, type DynamicOptionItem as b0, type DynamicOptionsConfig as b1, type DynamicOptionsResolver as b2, type DynamicOptionsResolverArgs as b3, type DyrectedLoggerConfig as b4, type DyrectedObservabilityConfig as b5, type EmailFieldAdmin as b6, type FieldAdminHooks as b7, type FieldAdminOnChangeHook as b8, type FieldAdminOnChangeHookArgs as b9, type JsonFormat as bA, LIFECYCLE_EVENT_NAMES as bB, type LifecycleEventHandler as bC, type LinkFormat as bD, type MetricColor as bE, type MultiSelectFieldAdmin as bF, type NamedAccessPolicy as bG, type NumberFieldAdmin as bH, type NumberFormat as bI, type NumberLimitFieldAdmin as bJ, type NumberLimitFieldConfig as bK, type NumericOperation as bL, type OIDCAdminAuthProvider as bM, type OptionFormat as bN, type PaginatedResult as bO, type PublicAdminAuthProvider as bP, type RadioFieldAdmin as bQ, type RateLimitConfig as bR, type ReadonlyDatabaseAdapter as bS, type RichTextFeature as bT, type RichTextFieldConfig as bU, type SelectFieldAdmin as bV, type SqlWhereResult as bW, type StorageAdapter as bX, type TextFieldAdmin as bY, type TextFormat as bZ, type TextareaFieldAdmin as b_, type FieldAdminOptionsHook as ba, type FieldAdminOptionsHookArgs as bb, type FieldAdminOptionsHookResult as bc, type FieldAfterReadHook as bd, type FieldAfterReadHookArgs as be, type FieldBase as bf, type FieldBeforeChangeHook as bg, type FieldBeforeChangeHookArgs as bh, type FieldHook as bi, type FieldHooks as bj, type FieldType as bk, type FileData as bl, type GlobalAfterChangeHook as bm, type GlobalAfterReadHook as bn, type GlobalAfterReadHookEntry as bo, type GlobalBeforeChangeHook as bp, type GlobalBeforeChangeHookEntry as bq, type GlobalBeforeReadHook as br, type GlobalBeforeReadHookEntry as bs, type HeadingLevel as bt, type HookFunction as bu, type IconFieldAdmin as bv, type ImageService as bw, type InferAggregateResult as bx, type JoinFieldAdmin as by, type JsonFieldAdmin as bz, type WorkflowTransition as c, type TypedField as c0, type UploadConfig as c1, type UrlFieldAdmin as c2, type UrlLinkValue as c3, type ViewActionFeatures as c4, type ViewComponentSlots as c5, type ViewConfig as c6, type ViewLayout as c7, type ViewMetric as c8, type ViewSubMetric as c9, type WhereClause as ca, type WhereOperator as cb, type WhereOperatorName as cc, type WordLimitFieldAdmin as cd, type WordLimitFieldConfig as ce, type WorkflowMetadata as cf, type WorkflowRole as cg, type WorkflowState as ch, type WorkflowTransitionContext as ci, defineAction as cj, defineView as ck, parseMongoWhere as cl, parseSqlWhere as cm, type LifecycleEvent as d, type BaseDocument as e, type DetailComputedOptions as f, type ComputedHandler as g, type DetailComputed as h, type DetailCustomOptions as i, type DetailCustom as j, type DetailDividerOptions as k, type DetailDivider as l, type DisplayFieldOptions as m, type DetailField as n, type DetailItem as o, type DetailGridOptions as p, type DetailGrid as q, type DetailRepeatOptions as r, type DetailRepeat as s, type DetailSectionOptions as t, type DetailSection as u, type DetailTabOptions as v, type DetailTab as w, type DetailTabsOptions as x, type DetailTabs as y, type DetailTextOptions as z };
3480
+ interface CollectionTokenPayload extends JWTPayload {
3481
+ sub: string;
3482
+ email: string;
3483
+ collection: string;
3484
+ sid?: string;
3485
+ purpose?: 'invite' | 'reset';
3486
+ providerId?: string;
3487
+ authSource?: 'local' | 'external';
3488
+ }
3489
+
3490
+ type RequestVars = DyrectedContext["Variables"];
3491
+ interface ResolvedObservabilityConfig {
3492
+ requestLogging: {
3493
+ enabled: boolean;
3494
+ logBodies: boolean;
3495
+ maxBodyBytes: number;
3496
+ redactPaths: string[];
3497
+ includeHeaders: string[];
3498
+ redactHeaders: string[];
3499
+ };
3500
+ sampling: {
3501
+ successRate: number;
3502
+ traceSuccessRate: number;
3503
+ bodySuccessRate: number;
3504
+ alwaysKeep4xx: boolean;
3505
+ alwaysKeep5xx: boolean;
3506
+ };
3507
+ tracing: {
3508
+ enabled: boolean;
3509
+ serviceName: string;
3510
+ exporter: "otlp" | "console" | "none";
3511
+ headers: Record<string, string>;
3512
+ endpoint?: string;
3513
+ };
3514
+ metrics: {
3515
+ enabled: boolean;
3516
+ exporter: "otlp" | "prometheus" | "none";
3517
+ endpoint?: string;
3518
+ path: string;
3519
+ };
3520
+ transports: {
3521
+ targets: Array<{
3522
+ type: "stdout";
3523
+ } | {
3524
+ type: "stderr";
3525
+ } | {
3526
+ type: "file";
3527
+ path: string;
3528
+ } | {
3529
+ type: "otlp";
3530
+ endpoint: string;
3531
+ headers?: Record<string, string>;
3532
+ }>;
3533
+ };
3534
+ }
3535
+ interface RequestTraceContext {
3536
+ span: Span;
3537
+ traceId: string;
3538
+ spanId: string;
3539
+ sampled: boolean;
3540
+ }
3541
+ interface RequestBodyCapture {
3542
+ attempted: boolean;
3543
+ contentType?: string;
3544
+ contentLength?: number;
3545
+ truncated?: boolean;
3546
+ parseFailed?: boolean;
3547
+ body?: unknown;
3548
+ }
3549
+ interface MetricsRuntime {
3550
+ requestCount: Counter<Attributes>;
3551
+ authFailureCount: Counter<Attributes>;
3552
+ uncaughtErrorCount: Counter<Attributes>;
3553
+ auditWriteFailureCount: Counter<Attributes>;
3554
+ emailSendFailureCount: Counter<Attributes>;
3555
+ workflowHookFailureCount: Counter<Attributes>;
3556
+ requestDuration: Histogram<Attributes>;
3557
+ }
3558
+ interface DyrectedObservabilityRuntime {
3559
+ logger: Logger;
3560
+ config: ResolvedObservabilityConfig;
3561
+ tracer?: Tracer;
3562
+ metrics?: MetricsRuntime;
3563
+ prometheusExporter?: PrometheusExporter;
3564
+ shutdown: () => Promise<void>;
3565
+ recordAuthFailure: (attributes?: Attributes) => void;
3566
+ recordUncaughtError: (attributes?: Attributes) => void;
3567
+ recordAuditWriteFailure: (attributes?: Attributes) => void;
3568
+ recordEmailSendFailure: (attributes?: Attributes) => void;
3569
+ recordWorkflowHookFailure: (attributes?: Attributes) => void;
3570
+ }
3571
+ declare function resolveObservabilityConfig(config?: DyrectedObservabilityConfig): ResolvedObservabilityConfig;
3572
+ declare function createObservabilityRuntime(config: DyrectedConfig): DyrectedObservabilityRuntime;
3573
+ declare function bindObservabilityRuntime(config: DyrectedConfig, runtime: DyrectedObservabilityRuntime): void;
3574
+ declare function getObservabilityRuntime(config: Pick<DyrectedConfig, "logger"> | undefined): DyrectedObservabilityRuntime | undefined;
3575
+ declare function getConfigLogger(config: Pick<DyrectedConfig, "logger"> | undefined, component: string): Logger;
3576
+ declare function getRequestLogger(c: Context<DyrectedContext>, component?: string): Logger;
3577
+ declare function buildRequestLogger(runtime: DyrectedObservabilityRuntime, vars: RequestVars, requestId?: string): Logger;
3578
+ declare function shouldSampleRequest(requestId: string | undefined, statusCode: number, sampling: ResolvedObservabilityConfig["sampling"], kind: "log" | "trace" | "body"): boolean;
3579
+ declare function redactHeaders(headers: Record<string, string>, observability: ResolvedObservabilityConfig): Record<string, string>;
3580
+ declare function captureRequestBody(request: Request, observability: ResolvedObservabilityConfig): Promise<RequestBodyCapture>;
3581
+ declare function redactBody(value: unknown, redactPaths: string[]): unknown;
3582
+ declare function createRequestSpan(runtime: DyrectedObservabilityRuntime, name: string, attributes: Attributes): RequestTraceContext | undefined;
3583
+ declare function endRequestSpan(requestTrace: RequestTraceContext | undefined, statusCode: number, error?: unknown): void;
3584
+ declare function attachRequestMetrics(runtime: DyrectedObservabilityRuntime, args: {
3585
+ method: string;
3586
+ route: string;
3587
+ statusCode: number;
3588
+ durationMs: number;
3589
+ }): void;
3590
+ declare function renderPrometheusMetrics(exporter: PrometheusExporter): Promise<{
3591
+ body: string;
3592
+ headers: Record<string, string>;
3593
+ statusCode: number;
3594
+ }>;
3595
+
3596
+ interface DyrectedContext {
3597
+ Variables: {
3598
+ config: DyrectedConfig;
3599
+ logger?: Logger;
3600
+ observability?: DyrectedObservabilityRuntime;
3601
+ siteId?: string;
3602
+ workspaceId?: string;
3603
+ requestBodyCapture?: RequestBodyCapture;
3604
+ requestTrace?: RequestTraceContext;
3605
+ /**
3606
+ * The authenticated user set by requireAuth() or optionalAuth() middleware.
3607
+ * Hydrated from the full user record (minus password) when a db adapter is
3608
+ * configured, so collection fields like `roles` are available; falls back to
3609
+ * the token's identity claims otherwise.
3610
+ */
3611
+ user?: {
3612
+ sub: string;
3613
+ email?: string;
3614
+ collection: string;
3615
+ [key: string]: any;
3616
+ };
3617
+ clientIp?: string;
3618
+ authTokenPayload?: CollectionTokenPayload;
3619
+ };
3620
+ }
3621
+ /**
3622
+ * Create the main Dyrected Hono application.
3623
+ */
3624
+ declare function createDyrectedApp(rawConfig: DyrectedConfig | any): Promise<Hono<DyrectedContext, hono_types.BlankSchema, "/">>;
3625
+
3626
+ export { type MultiSelectField as $, type AdminAuthConfig as A, type Block as B, type CollectionConfig as C, type DyrectedConfig as D, type DetailText as E, type Field as F, type GlobalConfig as G, type HookRequestContext as H, type DetailSchema as I, type DyrectedContext as J, type AIConfig as K, type LifecycleEventName as L, type AIPIIConfig as M, type ArrayField as N, type BlocksField as O, type PublicAdminAuthConfig as P, type BooleanField as Q, type AuthConfig as R, type AccessPolicyResolver as S, type DateField as T, type DateTimeField as U, type EmailField as V, type WorkflowConfig as W, type IconField as X, type ImageField as Y, type JoinField as Z, type JsonField as _, type DeclarativeHookExpression as a, type CollectionAfterReadHook as a$, type NumberField as a0, type ObjectField as a1, type RadioField as a2, type RelationshipField as a3, type RichTextField as a4, type RowField as a5, type SelectField as a6, type TextField as a7, type TextareaField as a8, type TimeField as a9, type ActionType as aA, type AdminAuthAccessResolution as aB, type AdminAuthClaimMapping as aC, type AdminAuthMember as aD, type AdminAuthProvider as aE, type AdminAuthProviderMembersConfig as aF, type AdminAuthProvisioningMode as aG, type AdminAuthResolveAccessArgs as aH, type AdminAuthResolvedIdentity as aI, type AdminConfig as aJ, type AdminDashboardComponentSlots as aK, type AdminIconName as aL, type AggregateArgs as aM, type AggregateCastType as aN, type AggregateCollectionResult as aO, type AggregateInput as aP, type AggregateOperation as aQ, type AggregateResult as aR, type BaseAdminAuthProvider as aS, type BaseFieldAdmin as aT, type BlockVariant as aU, type BooleanFieldAdmin as aV, type BooleanFormat as aW, type CharacterLimitFieldAdmin as aX, type CharacterLimitFieldConfig as aY, type CollectionAfterChangeHook as aZ, type CollectionAfterDeleteHook as a_, type UrlField as aa, type AIAction as ab, type AIActionStatus as ac, type AIActionType as ad, type AIAuditActionType as ae, type AIAuditRecord as af, type AIChunk as ag, type AIMessage as ah, type AIPIIPattern as ai, type AIRateLimitResult as aj, type AIRateLimitStore as ak, type AIThread as al, type AIToolContext as am, type AIToolDefinition as an, AI_ACTIONS_COLLECTION as ao, AI_AUDIT_COLLECTION as ap, AI_CHUNKS_COLLECTION as aq, AI_MESSAGES_COLLECTION as ar, AI_THREADS_COLLECTION as as, type AccessConfig as at, type AccessFunction as au, type AccessFunctionArgs as av, type AccessResult as aw, type AccessRule as ax, type ActionConfig as ay, type ActionContext as az, type AuthenticatedUser as b, type ImageTransformOptions as b$, type CollectionAfterReadHookEntry as b0, type CollectionAfterTransitionHook as b1, type CollectionBeforeChangeHook as b2, type CollectionBeforeChangeHookEntry as b3, type CollectionBeforeDeleteHook as b4, type CollectionBeforeReadHook as b5, type CollectionBeforeReadHookEntry as b6, type CollectionBeforeTransitionHook as b7, type CollectionListComponentSlots as b8, type CollectionRAGConfig as b9, type FieldAdminOptionsHook as bA, type FieldAdminOptionsHookArgs as bB, type FieldAdminOptionsHookResult as bC, type FieldAfterReadHook as bD, type FieldAfterReadHookArgs as bE, type FieldBase as bF, type FieldBeforeChangeHook as bG, type FieldBeforeChangeHookArgs as bH, type FieldHook as bI, type FieldHooks as bJ, type FieldType as bK, type FileData as bL, type GetDocumentResult as bM, type GlobalAfterChangeHook as bN, type GlobalAfterReadHook as bO, type GlobalAfterReadHookEntry as bP, type GlobalBeforeChangeHook as bQ, type GlobalBeforeChangeHookEntry as bR, type GlobalBeforeReadHook as bS, type GlobalBeforeReadHookEntry as bT, type GlobalRAGConfig as bU, type GlobalSchemaResult as bV, type GlobalSummaryResult as bW, type HeadingLevel as bX, type HookFunction as bY, type IconFieldAdmin as bZ, type ImageService as b_, type CollectionSchemaResult as ba, type CollectionSummaryResult as bb, type CollectionViewComponentSlots as bc, type CountOperation as bd, type CustomAdminAuthProvider as be, type DatabaseAdapter as bf, type DateFieldAdmin as bg, type DateFormat as bh, type DefineActionOptions as bi, type DefineViewOptions as bj, type DetailSpan as bk, type DisplayTone as bl, type DisplayVariant as bm, type DistinctCountOperation as bn, type DistinctValuesOperation as bo, type DynamicOptionItem as bp, type DynamicOptionsConfig as bq, type DynamicOptionsResolver as br, type DynamicOptionsResolverArgs as bs, type DyrectedAIContext as bt, type DyrectedLoggerConfig as bu, type DyrectedObservabilityConfig as bv, type EmailFieldAdmin as bw, type FieldAdminHooks as bx, type FieldAdminOnChangeHook as by, type FieldAdminOnChangeHookArgs as bz, type WorkflowTransition as c, buildRequestLogger as c$, type InferAggregateResult as c0, type JoinFieldAdmin as c1, type JsonFieldAdmin as c2, type JsonFormat as c3, LIFECYCLE_EVENT_NAMES as c4, type LifecycleEventHandler as c5, type LinkFormat as c6, type MetricColor as c7, type MultiSelectFieldAdmin as c8, type NamedAccessPolicy as c9, type UrlLinkValue as cA, type ViewActionFeatures as cB, type ViewComponentSlots as cC, type ViewConfig as cD, type ViewLayout as cE, type ViewMetric as cF, type ViewSubMetric as cG, type WhereClause as cH, type WhereOperator as cI, type WhereOperatorName as cJ, type WordLimitFieldAdmin as cK, type WordLimitFieldConfig as cL, type WorkflowMetadata as cM, type WorkflowRole as cN, type WorkflowState as cO, type WorkflowTransitionContext as cP, defineAction as cQ, defineView as cR, isAICollection as cS, parseMongoWhere as cT, parseSqlWhere as cU, type DyrectedObservabilityRuntime as cV, type RequestBodyCapture as cW, type RequestTraceContext as cX, type ResolvedObservabilityConfig as cY, attachRequestMetrics as cZ, bindObservabilityRuntime as c_, type NumberFieldAdmin as ca, type NumberFormat as cb, type NumberLimitFieldAdmin as cc, type NumberLimitFieldConfig as cd, type NumericOperation as ce, type OIDCAdminAuthProvider as cf, type OptionFormat as cg, type PaginatedResult as ch, type PublicAdminAuthProvider as ci, type QueryCollectionResult as cj, type RAGSearchResult as ck, type RadioFieldAdmin as cl, type RateLimitConfig as cm, type ReadonlyDatabaseAdapter as cn, type RichTextFeature as co, type RichTextFieldConfig as cp, type SelectFieldAdmin as cq, type SqlWhereResult as cr, type StorageAdapter as cs, type TextFieldAdmin as ct, type TextFormat as cu, type TextareaFieldAdmin as cv, type TrustProxyConfig as cw, type TypedField as cx, type UploadConfig as cy, type UrlFieldAdmin as cz, type LifecycleEvent as d, captureRequestBody as d0, createDyrectedApp as d1, createObservabilityRuntime as d2, createRequestSpan as d3, endRequestSpan as d4, getConfigLogger as d5, getObservabilityRuntime as d6, getRequestLogger as d7, redactBody as d8, redactHeaders as d9, renderPrometheusMetrics as da, resolveObservabilityConfig as db, shouldSampleRequest as dc, type BaseDocument as e, type DetailComputedOptions as f, type ComputedHandler as g, type DetailComputed as h, type DetailCustomOptions as i, type DetailCustom as j, type DetailDividerOptions as k, type DetailDivider as l, type DisplayFieldOptions as m, type DetailField as n, type DetailItem as o, type DetailGridOptions as p, type DetailGrid as q, type DetailRepeatOptions as r, type DetailRepeat as s, type DetailSectionOptions as t, type DetailSection as u, type DetailTabOptions as v, type DetailTab as w, type DetailTabsOptions as x, type DetailTabs as y, type DetailTextOptions as z };