@mdxui/do 2.1.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.
Files changed (42) hide show
  1. package/README.md +412 -0
  2. package/dist/__test-utils__/index.d.ts +399 -0
  3. package/dist/__test-utils__/index.js +34641 -0
  4. package/dist/__test-utils__/index.js.map +1 -0
  5. package/dist/agents-xcIn2dUB.d.ts +832 -0
  6. package/dist/chunk-EEDMN7UF.js +1351 -0
  7. package/dist/chunk-EEDMN7UF.js.map +1 -0
  8. package/dist/chunk-G3PMV62Z.js +33 -0
  9. package/dist/chunk-G3PMV62Z.js.map +1 -0
  10. package/dist/chunk-GGO5GW72.js +695 -0
  11. package/dist/chunk-GGO5GW72.js.map +1 -0
  12. package/dist/chunk-GKSP5RIA.js +3 -0
  13. package/dist/chunk-GKSP5RIA.js.map +1 -0
  14. package/dist/chunk-NXPXL5NA.js +3789 -0
  15. package/dist/chunk-NXPXL5NA.js.map +1 -0
  16. package/dist/chunk-PC5FJY6M.js +20 -0
  17. package/dist/chunk-PC5FJY6M.js.map +1 -0
  18. package/dist/chunk-XF6LKY2M.js +445 -0
  19. package/dist/chunk-XF6LKY2M.js.map +1 -0
  20. package/dist/components/index.d.ts +813 -0
  21. package/dist/components/index.js +8 -0
  22. package/dist/components/index.js.map +1 -0
  23. package/dist/do-CaQVueZw.d.ts +195 -0
  24. package/dist/hooks/index.d.ts +801 -0
  25. package/dist/hooks/index.js +7 -0
  26. package/dist/hooks/index.js.map +1 -0
  27. package/dist/index.d.ts +1012 -0
  28. package/dist/index.js +843 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/magic-string.es-J7BYFTTJ.js +1307 -0
  31. package/dist/magic-string.es-J7BYFTTJ.js.map +1 -0
  32. package/dist/providers/index.d.ts +90 -0
  33. package/dist/providers/index.js +5 -0
  34. package/dist/providers/index.js.map +1 -0
  35. package/dist/schemas/index.d.ts +206 -0
  36. package/dist/schemas/index.js +262 -0
  37. package/dist/schemas/index.js.map +1 -0
  38. package/dist/thing-DtI25yZh.d.ts +902 -0
  39. package/dist/types/index.d.ts +7681 -0
  40. package/dist/types/index.js +5 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/package.json +94 -0
@@ -0,0 +1,801 @@
1
+ import { a as ThingQueryResult, T as Thing, j as ThingVersion, k as TypeStats, b as ThingCreateInput, h as ThingUpdateInput, c as ThingFilter, d as ThingSort, e as ThingPagination } from '../thing-DtI25yZh.js';
2
+ import { QueryObserverResult, UseQueryResult, UseMutationResult } from '@tanstack/react-query';
3
+ import * as zod from 'zod';
4
+ import { EntityReference } from '../schemas/index.js';
5
+ import { RelationshipFilter, GraphPattern, Relationship, GraphTraversalResult, GraphStats, RelationshipCreateInput, PaginatedResult } from '../types/index.js';
6
+ import { q as WorkflowFilter, r as ExecutionFilter, U as AgentFilter, V as AgentExecutionFilter, a as Workflow, m as WorkflowExecution, s as Agent, B as AgentMetrics, F as AgentExecution, Q as AgentFeedback } from '../agents-xcIn2dUB.js';
7
+ import * as React from 'react';
8
+ import { DataProvider, DotdoDataProviderConfig, UseResourceConfig, UseResourceResult } from '@dotdo/react/admin';
9
+ export { AdminError, AdminErrorCode, AdminErrorDetails, CacheConfig, CreateParams, CreateResult, DataProvider, DataProviderConfig, DeleteManyParams, DeleteManyResult, DeleteParams, DeleteResult, AdminContextValue as DotdoAdminContextValue, AdminProvider as DotdoAdminProvider, DotdoDataProvider, DotdoDataProviderConfig, FilterOperator, GetListParams, GetListResult, GetManyParams, GetManyResult, GetOneParams, GetOneResult, InferredField, OptimisticConfig, QueryFilter, ResourceConfig, ResourceDefinition, SortOrder, UpdateParams, UpdateResult, createCacheKey, createResourceFromSchema, formatAdminError, inferFieldsFromSchema, invalidateCache, isAdminError, useAdminContext, useOptimisticUpdate } from '@dotdo/react/admin';
10
+ import { AdminProviderProps } from '@mdxui/admin/components';
11
+ export { AdminProvider } from '@mdxui/admin/components';
12
+ export { WorkflowContext, use$ } from '@dotdo/react';
13
+ import '../do-CaQVueZw.js';
14
+
15
+ /**
16
+ * Type definitions for Things hooks
17
+ *
18
+ * Provides return types for query and mutation hooks.
19
+ */
20
+
21
+ /**
22
+ * Return type for useThings hook
23
+ */
24
+ interface UseThingsResult {
25
+ /** The query result data, or null if not yet loaded */
26
+ data: ThingQueryResult | null;
27
+ /** True during initial load */
28
+ isLoading: boolean;
29
+ /** Error from the query, or null */
30
+ error: Error | null;
31
+ /** Function to manually refetch the data */
32
+ refetch: () => Promise<QueryObserverResult<ThingQueryResult, Error>>;
33
+ /** The query key used for cache management */
34
+ queryKey: readonly unknown[];
35
+ /** True if refetching in the background */
36
+ isRefetching: boolean;
37
+ /** True if any fetch is in progress */
38
+ isFetching: boolean;
39
+ /** Query status: 'pending', 'success', or 'error' */
40
+ status: 'pending' | 'success' | 'error';
41
+ }
42
+ /**
43
+ * Return type for useThing hook
44
+ */
45
+ interface UseThingResult {
46
+ /** The Thing data, or null if not yet loaded */
47
+ data: Thing | null;
48
+ /** True during initial load */
49
+ isLoading: boolean;
50
+ /** Error from the query, or null */
51
+ error: Error | null;
52
+ /** Function to manually refetch the data */
53
+ refetch: () => Promise<QueryObserverResult<Thing, Error>>;
54
+ /** The query key used for cache management */
55
+ queryKey: readonly unknown[];
56
+ /** True if refetching in the background */
57
+ isRefetching: boolean;
58
+ /** True if any fetch is in progress */
59
+ isFetching: boolean;
60
+ /** Query status: 'pending', 'success', or 'error' */
61
+ status: 'pending' | 'success' | 'error';
62
+ }
63
+ /**
64
+ * Return type for useThingVersions hook
65
+ */
66
+ interface UseThingVersionsResult {
67
+ /** The versions array, or null if not yet loaded */
68
+ data: ThingVersion[] | null;
69
+ /** True during initial load */
70
+ isLoading: boolean;
71
+ /** Error from the query, or null */
72
+ error: Error | null;
73
+ /** Function to manually refetch the data */
74
+ refetch: () => Promise<QueryObserverResult<ThingVersion[], Error>>;
75
+ /** The query key used for cache management */
76
+ queryKey: readonly unknown[];
77
+ /** True if refetching in the background */
78
+ isRefetching: boolean;
79
+ /** True if any fetch is in progress */
80
+ isFetching: boolean;
81
+ /** Query status: 'pending', 'success', or 'error' */
82
+ status: 'pending' | 'success' | 'error';
83
+ }
84
+ /**
85
+ * Return type for useTypeStats hook
86
+ */
87
+ interface UseTypeStatsResult {
88
+ /** The type statistics, or null if not yet loaded */
89
+ data: TypeStats | null;
90
+ /** True during initial load */
91
+ isLoading: boolean;
92
+ /** Error from the query, or null */
93
+ error: Error | null;
94
+ /** Function to manually refetch the data */
95
+ refetch: () => Promise<QueryObserverResult<TypeStats, Error>>;
96
+ /** The query key used for cache management */
97
+ queryKey: readonly unknown[];
98
+ /** True if refetching in the background */
99
+ isRefetching: boolean;
100
+ /** True if any fetch is in progress */
101
+ isFetching: boolean;
102
+ /** Query status: 'pending', 'success', or 'error' */
103
+ status: 'pending' | 'success' | 'error';
104
+ }
105
+ /**
106
+ * Return type for useCreateThing hook
107
+ */
108
+ interface UseCreateThingResult {
109
+ /** Trigger the mutation */
110
+ mutate: (input: ThingCreateInput) => void;
111
+ /** Trigger the mutation and return a promise */
112
+ mutateAsync: (input: ThingCreateInput) => Promise<Thing>;
113
+ /** True while mutation is in progress */
114
+ isLoading: boolean;
115
+ /** Error from the mutation, or null */
116
+ error: Error | null;
117
+ /** True if the mutation succeeded */
118
+ isSuccess: boolean;
119
+ /** Reset the mutation state */
120
+ reset: () => void;
121
+ }
122
+ /**
123
+ * Return type for useUpdateThing hook
124
+ */
125
+ interface UseUpdateThingResult {
126
+ /** Trigger the mutation */
127
+ mutate: (input: ThingUpdateInput) => void;
128
+ /** Trigger the mutation and return a promise */
129
+ mutateAsync: (input: ThingUpdateInput) => Promise<Thing>;
130
+ /** True while mutation is in progress */
131
+ isLoading: boolean;
132
+ /** Error from the mutation, or null */
133
+ error: Error | null;
134
+ /** True if the mutation succeeded */
135
+ isSuccess: boolean;
136
+ /** Reset the mutation state */
137
+ reset: () => void;
138
+ }
139
+ /**
140
+ * Options for delete operation
141
+ */
142
+ interface DeleteThingOptions {
143
+ /** If true, permanently delete instead of soft delete */
144
+ hard?: boolean;
145
+ }
146
+ /**
147
+ * Return type for useDeleteThing hook
148
+ */
149
+ interface UseDeleteThingResult {
150
+ /** Trigger the mutation */
151
+ mutate: (options?: DeleteThingOptions) => void;
152
+ /** Trigger the mutation and return a promise */
153
+ mutateAsync: (options?: DeleteThingOptions) => Promise<void>;
154
+ /** True while mutation is in progress */
155
+ isLoading: boolean;
156
+ /** Error from the mutation, or null */
157
+ error: Error | null;
158
+ /** True if the mutation succeeded */
159
+ isSuccess: boolean;
160
+ /** Reset the mutation state */
161
+ reset: () => void;
162
+ }
163
+
164
+ /**
165
+ * Hook to fetch a list of Things
166
+ *
167
+ * Uses two modes:
168
+ * - **TanStack DB mode**: Real-time sync via @dotdo/react useCollection
169
+ * - **REST/RPC mode**: React Query for caching with fetch or RPC calls
170
+ */
171
+ declare function useThings(filter?: ThingFilter, sort?: ThingSort, pagination?: ThingPagination): UseThingsResult;
172
+ /**
173
+ * Hook to fetch a single Thing
174
+ *
175
+ * Uses the useRPCClient hook for RPC calls instead of inline fetch,
176
+ * demonstrating the pattern for utilizing extracted utilities.
177
+ */
178
+ declare function useThing(ns: string, type: string, id: string): UseThingResult;
179
+ /**
180
+ * Hook to fetch Thing version history
181
+ */
182
+ declare function useThingVersions(ns: string, type: string, id: string): UseThingVersionsResult;
183
+ /**
184
+ * Hook to fetch type statistics
185
+ */
186
+ declare function useTypeStats(ns: string, type: string): UseTypeStatsResult;
187
+
188
+ /**
189
+ * Hook to create a Thing
190
+ *
191
+ * Automatically invalidates the things list cache on success.
192
+ *
193
+ * Supports three modes:
194
+ * 1. **DataProvider mode**: Uses DataProvider.create() when available (via DoDataProviderProvider)
195
+ * 2. **TanStack DB mode**: Uses RPC when doUrl is configured
196
+ * 3. **REST API mode**: Falls back to fetch-based API calls
197
+ */
198
+ declare function useCreateThing(): UseCreateThingResult;
199
+ /**
200
+ * Hook to update a Thing
201
+ *
202
+ * Automatically invalidates the related cache entries on success.
203
+ *
204
+ * Supports three modes:
205
+ * 1. **DataProvider mode**: Uses DataProvider.update() when available (via DoDataProviderProvider)
206
+ * 2. **TanStack DB mode**: Uses RPC when doUrl is configured
207
+ * 3. **REST API mode**: Falls back to fetch-based API calls
208
+ */
209
+ declare function useUpdateThing(ns: string, type: string, id: string): UseUpdateThingResult;
210
+ /**
211
+ * Hook to delete a Thing (soft delete by default)
212
+ *
213
+ * Automatically invalidates the related cache entries on success.
214
+ *
215
+ * Supports three modes:
216
+ * 1. **DataProvider mode**: Uses DataProvider.delete() when available (via DoDataProviderProvider)
217
+ * 2. **TanStack DB mode**: Uses RPC when doUrl is configured
218
+ * 3. **REST API mode**: Falls back to fetch-based API calls
219
+ *
220
+ * Note: DataProvider mode always performs soft delete. For hard delete,
221
+ * use RPC or REST API modes with `{ hard: true }` option.
222
+ */
223
+ declare function useDeleteThing(ns: string, type: string, id: string): UseDeleteThingResult;
224
+
225
+ /**
226
+ * Query keys for Things resource
227
+ *
228
+ * Things have a special key structure because:
229
+ * - List queries include filter, sort, and pagination
230
+ * - Detail queries use composite keys (ns, type, id) instead of a single id
231
+ * - Additional sub-queries for versions and type stats
232
+ */
233
+ declare const thingsKeys: {
234
+ all: readonly ["things"];
235
+ lists: () => readonly ["things", "list"];
236
+ list: (filter: ThingFilter, sort?: ThingSort, pagination?: ThingPagination) => readonly ["things", "list", {
237
+ readonly filter: zod.objectOutputType<{
238
+ ns: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
239
+ type: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
240
+ idPattern: zod.ZodOptional<zod.ZodString>;
241
+ nameSearch: zod.ZodOptional<zod.ZodString>;
242
+ createdAfter: zod.ZodOptional<zod.ZodDate>;
243
+ createdBefore: zod.ZodOptional<zod.ZodDate>;
244
+ updatedAfter: zod.ZodOptional<zod.ZodDate>;
245
+ updatedBefore: zod.ZodOptional<zod.ZodDate>;
246
+ includeDeleted: zod.ZodOptional<zod.ZodBoolean>;
247
+ properties: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
248
+ variant: zod.ZodOptional<zod.ZodString>;
249
+ }, zod.ZodTypeAny, "passthrough">;
250
+ readonly sort: {
251
+ field: "type" | "name" | "ts" | "createdAt" | "updatedAt";
252
+ order: "asc" | "desc";
253
+ } | undefined;
254
+ readonly pagination: {
255
+ page: number;
256
+ perPage: number;
257
+ } | undefined;
258
+ }];
259
+ details: () => readonly ["things", "detail"];
260
+ detail: (ns: string, type: string, id: string) => readonly ["things", "detail", string, string, string];
261
+ versions: (ns: string, type: string, id: string) => readonly ["things", "detail", string, string, string, "versions"];
262
+ types: () => readonly ["things", "types"];
263
+ typeStats: (ns: string, type: string) => readonly ["things", "types", string, string];
264
+ };
265
+ /**
266
+ * Query keys for Agents resource
267
+ *
268
+ * Includes keys for:
269
+ * - Agent lists and details
270
+ * - Agent metrics (per-agent)
271
+ * - Agent executions (list and detail)
272
+ */
273
+ declare const agentsKeys: {
274
+ all: readonly ["agents"];
275
+ lists: () => readonly ["agents", "list"];
276
+ list: (filter: AgentFilter) => readonly ["agents", "list", AgentFilter];
277
+ details: () => readonly ["agents", "detail"];
278
+ detail: (id: string) => readonly ["agents", "detail", string];
279
+ metrics: (id: string) => readonly ["agents", "detail", string, "metrics"];
280
+ executions: () => readonly ["agents", "executions"];
281
+ executionsList: (filter: AgentExecutionFilter) => readonly ["agents", "executions", "list", AgentExecutionFilter];
282
+ execution: (id: string) => readonly ["agents", "executions", "detail", string];
283
+ };
284
+ /**
285
+ * Query keys for Workflows resource
286
+ *
287
+ * Includes keys for:
288
+ * - Workflow lists and details
289
+ * - Workflow executions (list and detail)
290
+ */
291
+ declare const workflowsKeys: {
292
+ all: readonly ["workflows"];
293
+ lists: () => readonly ["workflows", "list"];
294
+ list: (filter: WorkflowFilter) => readonly ["workflows", "list", WorkflowFilter];
295
+ details: () => readonly ["workflows", "detail"];
296
+ detail: (id: string) => readonly ["workflows", "detail", string];
297
+ executions: () => readonly ["workflows", "executions"];
298
+ executionsList: (filter: ExecutionFilter) => readonly ["workflows", "executions", "list", ExecutionFilter];
299
+ execution: (id: string) => readonly ["workflows", "executions", "detail", string];
300
+ };
301
+ /**
302
+ * Query keys for Relationships resource
303
+ *
304
+ * Includes keys for:
305
+ * - Relationship lists and details
306
+ * - Graph traversal queries
307
+ * - Graph statistics
308
+ */
309
+ declare const relationshipsKeys: {
310
+ all: readonly ["relationships"];
311
+ lists: () => readonly ["relationships", "list"];
312
+ list: (filter: RelationshipFilter) => readonly ["relationships", "list", RelationshipFilter];
313
+ details: () => readonly ["relationships", "detail"];
314
+ detail: (id: string) => readonly ["relationships", "detail", string];
315
+ graph: () => readonly ["relationships", "graph"];
316
+ traverse: (entity: EntityReference, pattern: GraphPattern) => readonly ["relationships", "graph", {
317
+ type: string;
318
+ ns: string;
319
+ id: string;
320
+ semanticId: string;
321
+ name?: string | undefined;
322
+ }, GraphPattern];
323
+ stats: () => readonly ["relationships", "stats"];
324
+ };
325
+
326
+ /**
327
+ * Return type for useRelationships hook
328
+ */
329
+ type UseRelationshipsResult = UseQueryResult<Relationship[], Error>;
330
+ /**
331
+ * Result type for entity relationships containing both directions
332
+ */
333
+ interface EntityRelationshipsData {
334
+ outgoing: Relationship[];
335
+ incoming: Relationship[];
336
+ }
337
+ /**
338
+ * Return type for useEntityRelationships hook
339
+ */
340
+ type UseEntityRelationshipsResult = UseQueryResult<EntityRelationshipsData, Error>;
341
+ /**
342
+ * Return type for useGraphTraversal hook
343
+ */
344
+ type UseGraphTraversalResult = UseQueryResult<GraphTraversalResult, Error>;
345
+ /**
346
+ * Return type for useGraphStats hook
347
+ */
348
+ type UseGraphStatsResult = UseQueryResult<GraphStats, Error>;
349
+ /**
350
+ * Return type for useCreateRelationship hook
351
+ */
352
+ type UseCreateRelationshipResult = UseMutationResult<Relationship, Error, RelationshipCreateInput>;
353
+ /**
354
+ * Return type for useDeleteRelationship hook
355
+ */
356
+ type UseDeleteRelationshipResult = UseMutationResult<void, Error, string>;
357
+
358
+ /**
359
+ * Hook to fetch relationships
360
+ */
361
+ declare function useRelationships(filter?: RelationshipFilter): UseRelationshipsResult;
362
+ /**
363
+ * Hook to fetch relationships for a specific entity
364
+ */
365
+ declare function useEntityRelationships(entity: EntityReference, direction?: 'outgoing' | 'incoming' | 'both'): UseEntityRelationshipsResult;
366
+ /**
367
+ * Hook to traverse the graph from a starting entity
368
+ */
369
+ declare function useGraphTraversal(entity: EntityReference, pattern: GraphPattern): UseGraphTraversalResult;
370
+ /**
371
+ * Hook to get graph statistics
372
+ */
373
+ declare function useGraphStats(): UseGraphStatsResult;
374
+ /**
375
+ * Hook to create a relationship
376
+ */
377
+ declare function useCreateRelationship(): UseCreateRelationshipResult;
378
+ /**
379
+ * Hook to delete a relationship
380
+ */
381
+ declare function useDeleteRelationship(): UseDeleteRelationshipResult;
382
+
383
+ /**
384
+ * Return type for useWorkflows hook
385
+ */
386
+ type UseWorkflowsResult = UseQueryResult<PaginatedResult<Workflow>, Error>;
387
+ /**
388
+ * Return type for useWorkflow hook
389
+ */
390
+ type UseWorkflowResult = UseQueryResult<Workflow, Error>;
391
+ /**
392
+ * Return type for useWorkflowExecutions hook
393
+ */
394
+ type UseWorkflowExecutionsResult = UseQueryResult<PaginatedResult<WorkflowExecution>, Error>;
395
+ /**
396
+ * Return type for useWorkflowExecution hook
397
+ */
398
+ type UseWorkflowExecutionResult = UseQueryResult<WorkflowExecution, Error>;
399
+ /**
400
+ * Return type for useCreateWorkflow hook
401
+ */
402
+ type UseCreateWorkflowResult = UseMutationResult<Workflow, Error, Partial<Workflow>>;
403
+ /**
404
+ * Return type for useUpdateWorkflow hook
405
+ */
406
+ type UseUpdateWorkflowResult = UseMutationResult<Workflow, Error, Partial<Workflow>>;
407
+ /**
408
+ * Return type for useTriggerWorkflow hook
409
+ */
410
+ type UseTriggerWorkflowResult = UseMutationResult<WorkflowExecution, Error, Record<string, unknown> | undefined>;
411
+ /**
412
+ * Return type for useCancelExecution hook
413
+ */
414
+ type UseCancelExecutionResult = UseMutationResult<void, Error, string>;
415
+ /**
416
+ * Return type for useDeleteWorkflow hook
417
+ */
418
+ type UseDeleteWorkflowResult = UseMutationResult<void, Error, string>;
419
+
420
+ /**
421
+ * Hook to fetch workflows
422
+ */
423
+ declare function useWorkflows(filter?: WorkflowFilter): UseWorkflowsResult;
424
+ /**
425
+ * Hook to fetch a single workflow
426
+ */
427
+ declare function useWorkflow(id: string): UseWorkflowResult;
428
+ /**
429
+ * Hook to fetch workflow executions
430
+ */
431
+ declare function useWorkflowExecutions(filter?: ExecutionFilter): UseWorkflowExecutionsResult;
432
+ /**
433
+ * Hook to fetch a single execution
434
+ */
435
+ declare function useWorkflowExecution(id: string): UseWorkflowExecutionResult;
436
+ /**
437
+ * Hook to create a workflow
438
+ */
439
+ declare function useCreateWorkflow(): UseCreateWorkflowResult;
440
+ /**
441
+ * Hook to update a workflow
442
+ */
443
+ declare function useUpdateWorkflow(id: string): UseUpdateWorkflowResult;
444
+ /**
445
+ * Hook to trigger a workflow manually
446
+ */
447
+ declare function useTriggerWorkflow(id: string): UseTriggerWorkflowResult;
448
+ /**
449
+ * Hook to cancel a workflow execution
450
+ */
451
+ declare function useCancelExecution(): UseCancelExecutionResult;
452
+ /**
453
+ * Hook to delete a workflow
454
+ */
455
+ declare function useDeleteWorkflow(): UseDeleteWorkflowResult;
456
+
457
+ /**
458
+ * Return type for useAgents hook
459
+ */
460
+ type UseAgentsResult = UseQueryResult<PaginatedResult<Agent>, Error>;
461
+ /**
462
+ * Return type for useAgent hook
463
+ */
464
+ type UseAgentResult = UseQueryResult<Agent, Error>;
465
+ /**
466
+ * Return type for useAgentMetrics hook
467
+ */
468
+ type UseAgentMetricsResult = UseQueryResult<AgentMetrics, Error>;
469
+ /**
470
+ * Return type for useAgentExecutions hook
471
+ */
472
+ type UseAgentExecutionsResult = UseQueryResult<PaginatedResult<AgentExecution>, Error>;
473
+ /**
474
+ * Return type for useAgentExecution hook
475
+ */
476
+ type UseAgentExecutionResult = UseQueryResult<AgentExecution, Error>;
477
+ /**
478
+ * Return type for useCreateAgent hook
479
+ */
480
+ type UseCreateAgentResult = UseMutationResult<Agent, Error, Partial<Agent>>;
481
+ /**
482
+ * Return type for useUpdateAgent hook
483
+ */
484
+ type UseUpdateAgentResult = UseMutationResult<Agent, Error, Partial<Agent>>;
485
+ /**
486
+ * Input type for useExecuteAgent mutation
487
+ */
488
+ interface ExecuteAgentInput {
489
+ task: string;
490
+ context?: Record<string, unknown>;
491
+ }
492
+ /**
493
+ * Return type for useExecuteAgent hook
494
+ */
495
+ type UseExecuteAgentResult = UseMutationResult<AgentExecution, Error, ExecuteAgentInput>;
496
+ /**
497
+ * Input type for useSubmitAgentFeedback mutation
498
+ */
499
+ type SubmitAgentFeedbackInput = Omit<AgentFeedback, 'submittedAt' | 'submittedBy'>;
500
+ /**
501
+ * Return type for useSubmitAgentFeedback hook
502
+ */
503
+ type UseSubmitAgentFeedbackResult = UseMutationResult<void, Error, SubmitAgentFeedbackInput>;
504
+ /**
505
+ * Return type for useDeleteAgent hook
506
+ */
507
+ type UseDeleteAgentResult = UseMutationResult<void, Error, string>;
508
+
509
+ /**
510
+ * Hook to fetch agents
511
+ */
512
+ declare function useAgents(filter?: AgentFilter): UseAgentsResult;
513
+ /**
514
+ * Hook to fetch a single agent
515
+ */
516
+ declare function useAgent(id: string): UseAgentResult;
517
+ /**
518
+ * Hook to fetch agent metrics
519
+ */
520
+ declare function useAgentMetrics(id: string, periodDays?: number): UseAgentMetricsResult;
521
+ /**
522
+ * Hook to fetch agent executions
523
+ */
524
+ declare function useAgentExecutions(filter?: AgentExecutionFilter): UseAgentExecutionsResult;
525
+ /**
526
+ * Hook to fetch a single agent execution
527
+ */
528
+ declare function useAgentExecution(id: string): UseAgentExecutionResult;
529
+ /**
530
+ * Hook to create an agent
531
+ */
532
+ declare function useCreateAgent(): UseCreateAgentResult;
533
+ /**
534
+ * Hook to update an agent
535
+ */
536
+ declare function useUpdateAgent(id: string): UseUpdateAgentResult;
537
+ /**
538
+ * Hook to execute an agent
539
+ */
540
+ declare function useExecuteAgent(id: string): UseExecuteAgentResult;
541
+ /**
542
+ * Hook to submit feedback for an agent execution
543
+ */
544
+ declare function useSubmitAgentFeedback(executionId: string): UseSubmitAgentFeedbackResult;
545
+ /**
546
+ * Hook to delete an agent
547
+ */
548
+ declare function useDeleteAgent(): UseDeleteAgentResult;
549
+
550
+ /**
551
+ * DO Provider
552
+ *
553
+ * Combined provider that wraps both @mdxui/admin AdminProvider
554
+ * and @dotdo/react AdminProvider for Durable Objects integration.
555
+ *
556
+ * @module @mdxui/do/hooks/dotdo
557
+ */
558
+
559
+ /**
560
+ * Configuration for DO provider
561
+ */
562
+ interface DOProps {
563
+ /** Child components */
564
+ children: React.ReactNode;
565
+ /**
566
+ * Durable Object namespace URL.
567
+ * If provided, creates a DotdoDataProvider automatically.
568
+ * @example 'https://api.example.com.ai/do/workspace'
569
+ */
570
+ ns?: string;
571
+ /**
572
+ * Pre-configured DataProvider instance.
573
+ * Use this for custom data provider configurations.
574
+ * Takes precedence over `ns` if both are provided.
575
+ */
576
+ dataProvider?: DataProvider;
577
+ /**
578
+ * Additional configuration for DotdoDataProvider.
579
+ * Only used when `ns` is provided.
580
+ */
581
+ dotdoConfig?: Omit<DotdoDataProviderConfig, 'ns'>;
582
+ /**
583
+ * @mdxui/admin AdminProvider configuration.
584
+ */
585
+ adminConfig?: Omit<AdminProviderProps, 'children'>;
586
+ /**
587
+ * Theme preference for the admin UI.
588
+ * @default 'system'
589
+ */
590
+ theme?: 'light' | 'dark' | 'system';
591
+ /**
592
+ * Base path for admin routes.
593
+ * @default ''
594
+ */
595
+ basename?: string;
596
+ /**
597
+ * Admin application title.
598
+ * @default 'Admin'
599
+ */
600
+ title?: string;
601
+ /**
602
+ * Logo element for the admin UI.
603
+ */
604
+ logo?: React.ReactNode;
605
+ }
606
+ /**
607
+ * Context value for DO Admin specific features (dotdo integration)
608
+ */
609
+ interface DOAdminContextValue {
610
+ /** The configured data provider */
611
+ dataProvider: DataProvider | null;
612
+ /** Whether DO integration is enabled */
613
+ isDOEnabled: boolean;
614
+ /** The DO namespace URL if configured */
615
+ ns: string | null;
616
+ }
617
+ /**
618
+ * Combined admin provider for @mdxui/admin with Durable Objects support.
619
+ *
620
+ * Wraps both the @mdxui/admin AdminProvider and @dotdo/react AdminProvider,
621
+ * providing a unified context for admin applications backed by Durable Objects.
622
+ *
623
+ * @example
624
+ * ```tsx
625
+ * import { DO } from '@mdxui/do'
626
+ *
627
+ * function App() {
628
+ * return (
629
+ * <DO
630
+ * ns="https://api.example.com.ai/do/workspace"
631
+ * title="My Admin"
632
+ * theme="dark"
633
+ * >
634
+ * <Resource name="users" list={UserList} edit={UserEdit} />
635
+ * <Resource name="posts" list={PostList} create={PostCreate} />
636
+ * </DO>
637
+ * )
638
+ * }
639
+ * ```
640
+ *
641
+ * @example
642
+ * ```tsx
643
+ * // With custom data provider configuration
644
+ * import { DO, DotdoDataProvider } from '@mdxui/do'
645
+ *
646
+ * function App() {
647
+ * const dataProvider = DotdoDataProvider({
648
+ * ns: 'https://api.example.com.ai/do/workspace',
649
+ * headers: { Authorization: 'Bearer token' },
650
+ * timeout: 60000,
651
+ * })
652
+ *
653
+ * return (
654
+ * <DO dataProvider={dataProvider} title="My Admin">
655
+ * <AdminRoutes />
656
+ * </DO>
657
+ * )
658
+ * }
659
+ * ```
660
+ */
661
+ declare function DO({ children, ns, dataProvider: providedDataProvider, dotdoConfig, adminConfig, theme, basename, title, logo, }: DOProps): React.ReactElement;
662
+ declare namespace DO {
663
+ var displayName: string;
664
+ }
665
+ /**
666
+ * Hook to access DO-specific admin context.
667
+ *
668
+ * @returns DO context value
669
+ *
670
+ * @example
671
+ * ```tsx
672
+ * function MyComponent() {
673
+ * const { isDOEnabled, ns } = useDOContext()
674
+ *
675
+ * if (!isDOEnabled) {
676
+ * return <div>DO backend not configured</div>
677
+ * }
678
+ *
679
+ * return <div>Connected to: {ns}</div>
680
+ * }
681
+ * ```
682
+ */
683
+ declare function useDOContext(): DOAdminContextValue;
684
+ /**
685
+ * Hook to check if DO integration is enabled.
686
+ *
687
+ * @returns Whether DO backend is configured
688
+ */
689
+ declare function useIsDOEnabled(): boolean;
690
+
691
+ /**
692
+ * useDO Hook
693
+ *
694
+ * Wrapper around @dotdo/react/admin useResource that provides
695
+ * @mdxui/do-specific defaults and type safety.
696
+ *
697
+ * @module @mdxui/do/hooks/dotdo
698
+ */
699
+
700
+ /**
701
+ * Base record type for DO-backed resources.
702
+ * Records must have either $id (dotdo style) or id (standard style).
703
+ */
704
+ interface BaseRecord {
705
+ /** Dotdo-style unique identifier */
706
+ $id?: string;
707
+ /** Standard unique identifier */
708
+ id?: string;
709
+ /** Additional fields */
710
+ [key: string]: unknown;
711
+ }
712
+ /**
713
+ * Configuration for useDO hook
714
+ *
715
+ * Extends the base @dotdo/react useResource config with
716
+ * @mdxui/do-specific options.
717
+ */
718
+ interface UseDOConfig<T extends BaseRecord = BaseRecord> extends UseResourceConfig<T> {
719
+ /**
720
+ * Whether to show toast notifications on errors.
721
+ * @default true
722
+ */
723
+ showToasts?: boolean;
724
+ /**
725
+ * Transform function to apply to fetched data.
726
+ * Useful for mapping DO response to UI-expected format.
727
+ */
728
+ transform?: (data: T[]) => T[];
729
+ /**
730
+ * Custom empty state message when no data is returned.
731
+ */
732
+ emptyMessage?: string;
733
+ }
734
+ /**
735
+ * Return type for useDO hook
736
+ *
737
+ * Extends base result with additional @mdxui/do utilities.
738
+ */
739
+ interface UseDOResult<T extends BaseRecord> extends UseResourceResult<T> {
740
+ /**
741
+ * Whether the data set is empty (no items after loading completes).
742
+ */
743
+ isEmpty: boolean;
744
+ /**
745
+ * Message to display when data is empty.
746
+ */
747
+ emptyMessage: string;
748
+ /**
749
+ * Whether the current data is stale (from cache, not fresh).
750
+ */
751
+ isStale: boolean;
752
+ /**
753
+ * Get a record by index from the current data.
754
+ */
755
+ getByIndex: (index: number) => T | undefined;
756
+ }
757
+ /**
758
+ * React hook for working with a Durable Objects resource collection.
759
+ *
760
+ * Wraps @dotdo/react/admin useResource with @mdxui/do conventions
761
+ * and additional utilities.
762
+ *
763
+ * @example
764
+ * ```tsx
765
+ * import { useDOResource } from '@mdxui/do'
766
+ *
767
+ * function UserList() {
768
+ * const {
769
+ * data: users,
770
+ * isLoading,
771
+ * isEmpty,
772
+ * emptyMessage,
773
+ * create,
774
+ * update,
775
+ * remove,
776
+ * } = useDOResource<User>({
777
+ * resource: 'User',
778
+ * perPage: 20,
779
+ * sort: { field: 'createdAt', order: 'desc' },
780
+ * })
781
+ *
782
+ * if (isLoading) return <LoadingSpinner />
783
+ * if (isEmpty) return <EmptyState message={emptyMessage} />
784
+ *
785
+ * return (
786
+ * <DataGrid columns={columns} data={users} />
787
+ * )
788
+ * }
789
+ * ```
790
+ *
791
+ * @param config - Configuration options for the resource hook
792
+ * @returns Resource state and mutation functions
793
+ */
794
+ declare function useDOResource<T extends BaseRecord = BaseRecord>(config: UseDOConfig<T>): UseDOResult<T>;
795
+ /**
796
+ * @deprecated Use useDOResource instead. This alias is kept for backward compatibility.
797
+ * Note: This conflicts with useDO from providers/do-provider.tsx, so import explicitly if needed.
798
+ */
799
+ declare const useDOAdmin: typeof useDOResource;
800
+
801
+ export { type BaseRecord, DO, type DOAdminContextValue, type DOProps, type DeleteThingOptions, type EntityRelationshipsData, type ExecuteAgentInput, type SubmitAgentFeedbackInput, type UseAgentExecutionResult, type UseAgentExecutionsResult, type UseAgentMetricsResult, type UseAgentResult, type UseAgentsResult, type UseCancelExecutionResult, type UseCreateAgentResult, type UseCreateRelationshipResult, type UseCreateThingResult, type UseCreateWorkflowResult, type UseDOConfig, type UseDOResult, type UseDeleteAgentResult, type UseDeleteRelationshipResult, type UseDeleteThingResult, type UseDeleteWorkflowResult, type UseEntityRelationshipsResult, type UseExecuteAgentResult, type UseGraphStatsResult, type UseGraphTraversalResult, type UseRelationshipsResult, type UseSubmitAgentFeedbackResult, type UseThingResult, type UseThingVersionsResult, type UseThingsResult, type UseTriggerWorkflowResult, type UseTypeStatsResult, type UseUpdateAgentResult, type UseUpdateThingResult, type UseUpdateWorkflowResult, type UseWorkflowExecutionResult, type UseWorkflowExecutionsResult, type UseWorkflowResult, type UseWorkflowsResult, agentsKeys, relationshipsKeys, thingsKeys, useAgent, useAgentExecution, useAgentExecutions, useAgentMetrics, useAgents, useCancelExecution, useCreateAgent, useCreateRelationship, useCreateThing, useCreateWorkflow, useDOAdmin, useDOContext, useDOResource, useDeleteAgent, useDeleteRelationship, useDeleteThing, useDeleteWorkflow, useEntityRelationships, useExecuteAgent, useGraphStats, useGraphTraversal, useIsDOEnabled, useRelationships, useSubmitAgentFeedback, useThing, useThingVersions, useThings, useTriggerWorkflow, useTypeStats, useUpdateAgent, useUpdateThing, useUpdateWorkflow, useWorkflow, useWorkflowExecution, useWorkflowExecutions, useWorkflows, workflowsKeys };