@mdxui/do 2.1.1 → 4.0.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.
Files changed (75) hide show
  1. package/README.md +115 -323
  2. package/dist/{agents-xcIn2dUB.d.ts → agents-2_r9e9i7.d.ts} +213 -2
  3. package/dist/app/index.d.ts +347 -0
  4. package/dist/app/index.js +14 -0
  5. package/dist/app/index.js.map +1 -0
  6. package/dist/breadcrumbs-C9Qn3S7d.d.ts +81 -0
  7. package/dist/capnweb-client-Bq78FtEA.d.ts +229 -0
  8. package/dist/chunk-3XKYQRXY.js +192 -0
  9. package/dist/chunk-3XKYQRXY.js.map +1 -0
  10. package/dist/chunk-4KXVN3EQ.js +56 -0
  11. package/dist/chunk-4KXVN3EQ.js.map +1 -0
  12. package/dist/chunk-5SHZZC7L.js +234 -0
  13. package/dist/chunk-5SHZZC7L.js.map +1 -0
  14. package/dist/chunk-7UFINK3Q.js +1994 -0
  15. package/dist/chunk-7UFINK3Q.js.map +1 -0
  16. package/dist/chunk-JJLAES6W.js +76 -0
  17. package/dist/chunk-JJLAES6W.js.map +1 -0
  18. package/dist/chunk-KT52UU3U.js +985 -0
  19. package/dist/chunk-KT52UU3U.js.map +1 -0
  20. package/dist/chunk-LJIWB7KE.js +95 -0
  21. package/dist/chunk-LJIWB7KE.js.map +1 -0
  22. package/dist/chunk-NA652ART.js +596 -0
  23. package/dist/chunk-NA652ART.js.map +1 -0
  24. package/dist/chunk-OVLO7UOH.js +1071 -0
  25. package/dist/chunk-OVLO7UOH.js.map +1 -0
  26. package/dist/chunk-VRLUXCLD.js +31 -0
  27. package/dist/chunk-VRLUXCLD.js.map +1 -0
  28. package/dist/chunk-WMNT4OIE.js +249 -0
  29. package/dist/chunk-WMNT4OIE.js.map +1 -0
  30. package/dist/chunk-Y52IEYVM.js +131 -0
  31. package/dist/chunk-Y52IEYVM.js.map +1 -0
  32. package/dist/components/index.d.ts +14 -732
  33. package/dist/components/index.js +3 -6
  34. package/dist/config-CxvpD8Y6.d.ts +111 -0
  35. package/dist/{do-CaQVueZw.d.ts → do-D27i5bU0.d.ts} +32 -33
  36. package/dist/errors-DratdVIz.d.ts +346 -0
  37. package/dist/hooks/index.d.ts +450 -691
  38. package/dist/hooks/index.js +6 -4
  39. package/dist/hooks/things/index.d.ts +298 -0
  40. package/dist/hooks/things/index.js +8 -0
  41. package/dist/hooks/things/index.js.map +1 -0
  42. package/dist/index.d.ts +62 -989
  43. package/dist/index.js +12 -839
  44. package/dist/index.js.map +1 -1
  45. package/dist/lib/index.d.ts +798 -0
  46. package/dist/lib/index.js +6 -0
  47. package/dist/lib/index.js.map +1 -0
  48. package/dist/providers/index.d.ts +130 -34
  49. package/dist/providers/index.js +3 -2
  50. package/dist/query-keys-CZNFikIi.d.ts +153 -0
  51. package/dist/schemas/index.d.ts +5 -5
  52. package/dist/schemas/index.js +2 -2
  53. package/dist/schemas/index.js.map +1 -1
  54. package/dist/{thing-DtI25yZh.d.ts → thing-BF25aUtJ.d.ts} +72 -72
  55. package/dist/types/index.d.ts +693 -658
  56. package/dist/types/index.js +1 -2
  57. package/dist/views/index.d.ts +131 -0
  58. package/dist/views/index.js +11 -0
  59. package/dist/views/index.js.map +1 -0
  60. package/package.json +39 -17
  61. package/dist/__test-utils__/index.d.ts +0 -399
  62. package/dist/__test-utils__/index.js +0 -34641
  63. package/dist/__test-utils__/index.js.map +0 -1
  64. package/dist/chunk-EEDMN7UF.js +0 -1351
  65. package/dist/chunk-EEDMN7UF.js.map +0 -1
  66. package/dist/chunk-G3PMV62Z.js +0 -33
  67. package/dist/chunk-G3PMV62Z.js.map +0 -1
  68. package/dist/chunk-NXPXL5NA.js +0 -3789
  69. package/dist/chunk-NXPXL5NA.js.map +0 -1
  70. package/dist/chunk-PC5FJY6M.js +0 -20
  71. package/dist/chunk-PC5FJY6M.js.map +0 -1
  72. package/dist/chunk-XF6LKY2M.js +0 -445
  73. package/dist/chunk-XF6LKY2M.js.map +0 -1
  74. package/dist/magic-string.es-J7BYFTTJ.js +0 -1307
  75. package/dist/magic-string.es-J7BYFTTJ.js.map +0 -1
@@ -1,801 +1,560 @@
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';
1
+ import { N as Namespace, S as SemanticType, c as ThingFilter, T as Thing } from '../thing-BF25aUtJ.js';
2
+ export { DeleteThingOptions, UseCreateThingResult, UseDeleteThingResult, UseThingResult, UseThingVersionsResult, UseThingsResult, UseTypeStatsResult, UseUpdateThingResult, useCreateThing, useDeleteThing, useThing, useThingVersions, useThings, useTypeStats, useUpdateThing } from './things/index.js';
3
+ export { t as thingsKeys } from '../query-keys-CZNFikIi.js';
4
+ import { a as BreadcrumbItemConfig } from '../breadcrumbs-C9Qn3S7d.js';
5
+ import 'zod';
6
+ import '@tanstack/react-query';
7
+ import '../schemas/index.js';
8
+ import '../agents-2_r9e9i7.js';
9
+ import 'react/jsx-runtime';
10
+ import 'react';
14
11
 
15
12
  /**
16
- * Type definitions for Things hooks
17
- *
18
- * Provides return types for query and mutation hooks.
19
- */
20
-
13
+ * Property definition in a schema
14
+ */
15
+ interface SchemaProperty {
16
+ /** Property name */
17
+ name: string;
18
+ /** Property type (string, number, boolean, object, array, etc.) */
19
+ type: string;
20
+ /** Whether the property is required */
21
+ required?: boolean;
22
+ /** Property description */
23
+ description?: string;
24
+ /** Default value */
25
+ default?: unknown;
26
+ /** For array types, the item type */
27
+ items?: SchemaProperty;
28
+ /** For object types, nested properties */
29
+ properties?: SchemaProperty[];
30
+ }
21
31
  /**
22
- * Return type for useThings hook
32
+ * Schema definition for a resource type
23
33
  */
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';
34
+ interface SchemaDefinition {
35
+ /** Schema name (usually the type name) */
36
+ name: string;
37
+ /** Namespace this schema belongs to */
38
+ ns?: string;
39
+ /** Human-readable description */
40
+ description?: string;
41
+ /** Properties defined in this schema */
42
+ properties: SchemaProperty[];
43
+ /** Primary key field(s) */
44
+ primaryKey?: string | string[];
45
+ /** Indexes defined on this schema */
46
+ indexes?: Array<{
47
+ name: string;
48
+ fields: string[];
49
+ unique?: boolean;
50
+ }>;
51
+ /** Timestamps */
52
+ createdAt?: Date;
53
+ updatedAt?: Date;
41
54
  }
42
55
  /**
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';
56
+ * Result from schema discovery
57
+ */
58
+ interface SchemaDiscoveryResult {
59
+ /** Available schemas */
60
+ schemas: SchemaDefinition[];
61
+ /** Available namespaces */
62
+ namespaces: string[];
63
+ /** Types by namespace */
64
+ typesByNamespace: Record<string, string[]>;
65
+ /** Server version/info */
66
+ serverInfo?: {
67
+ version?: string;
68
+ capabilities?: string[];
69
+ };
62
70
  }
63
71
  /**
64
- * Return type for useThingVersions hook
72
+ * Options for useSchema hook
65
73
  */
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';
74
+ interface UseSchemaOptions {
75
+ /** Filter by namespace */
76
+ ns?: string;
77
+ /** Filter by type name */
78
+ type?: string;
79
+ /** Whether to include system schemas */
80
+ includeSystem?: boolean;
81
+ /** Enable/disable the query */
82
+ enabled?: boolean;
83
83
  }
84
84
  /**
85
- * Return type for useTypeStats hook
85
+ * Result from useSchema hook
86
86
  */
87
- interface UseTypeStatsResult {
88
- /** The type statistics, or null if not yet loaded */
89
- data: TypeStats | null;
90
- /** True during initial load */
87
+ interface UseSchemaResult {
88
+ /** Schema discovery result */
89
+ data: SchemaDiscoveryResult | null;
90
+ /** Loading state */
91
91
  isLoading: boolean;
92
- /** Error from the query, or null */
92
+ /** Error if any */
93
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 */
94
+ /** Refetch function */
95
+ refetch: () => Promise<unknown>;
96
+ /** Whether data is being refetched */
99
97
  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
98
  }
99
+ declare const schemaKeys: {
100
+ all: readonly ["schema"];
101
+ discovery: (ns?: string) => readonly ["schema", "discovery", string];
102
+ definition: (ns: string, type: string) => readonly ["schema", "definition", string, string];
103
+ };
105
104
  /**
106
- * Return type for useCreateThing hook
105
+ * Hook to discover schemas from the DO backend
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * function SchemaExplorer() {
110
+ * const { data, isLoading } = useSchema()
111
+ *
112
+ * if (isLoading) return <div>Loading schemas...</div>
113
+ *
114
+ * return (
115
+ * <ul>
116
+ * {data?.schemas.map(schema => (
117
+ * <li key={schema.name}>{schema.name}</li>
118
+ * ))}
119
+ * </ul>
120
+ * )
121
+ * }
122
+ * ```
107
123
  */
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
- }
124
+ declare function useSchema(options?: UseSchemaOptions): UseSchemaResult;
122
125
  /**
123
- * Return type for useUpdateThing hook
126
+ * Hook to get a specific schema definition
127
+ *
128
+ * @example
129
+ * ```tsx
130
+ * function SchemaViewer({ ns, type }: { ns: string; type: string }) {
131
+ * const { data, isLoading } = useSchemaDefinition(ns, type)
132
+ *
133
+ * if (isLoading) return <div>Loading...</div>
134
+ *
135
+ * return (
136
+ * <pre>{JSON.stringify(data, null, 2)}</pre>
137
+ * )
138
+ * }
139
+ * ```
124
140
  */
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 */
141
+ declare function useSchemaDefinition(ns: string, type: string, options?: {
142
+ enabled?: boolean;
143
+ }): {
144
+ data: SchemaDefinition | null;
131
145
  isLoading: boolean;
132
- /** Error from the mutation, or null */
133
146
  error: Error | null;
134
- /** True if the mutation succeeded */
135
- isSuccess: boolean;
136
- /** Reset the mutation state */
137
- reset: () => void;
138
- }
147
+ refetch: () => Promise<unknown>;
148
+ };
149
+
139
150
  /**
140
- * Options for delete operation
151
+ * Options for useNamespaces hook
141
152
  */
142
- interface DeleteThingOptions {
143
- /** If true, permanently delete instead of soft delete */
144
- hard?: boolean;
153
+ interface UseNamespacesOptions {
154
+ /** Include hidden/system namespaces */
155
+ includeSystem?: boolean;
156
+ /** Enable/disable the query */
157
+ enabled?: boolean;
145
158
  }
146
159
  /**
147
- * Return type for useDeleteThing hook
160
+ * Result from useNamespaces hook
148
161
  */
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 */
162
+ interface UseNamespacesResult {
163
+ /** List of namespaces */
164
+ data: Namespace[] | null;
165
+ /** Loading state */
155
166
  isLoading: boolean;
156
- /** Error from the mutation, or null */
167
+ /** Error if any */
157
168
  error: Error | null;
158
- /** True if the mutation succeeded */
159
- isSuccess: boolean;
160
- /** Reset the mutation state */
161
- reset: () => void;
169
+ /** Refetch function */
170
+ refetch: () => Promise<unknown>;
171
+ /** Whether data is being refetched */
172
+ isRefetching: boolean;
173
+ /** Query status */
174
+ status: 'pending' | 'error' | 'success';
162
175
  }
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;
176
+ declare const namespacesKeys: {
177
+ all: readonly ["namespaces"];
178
+ list: (includeSystem?: boolean) => readonly ["namespaces", "list", boolean];
179
+ };
210
180
  /**
211
- * Hook to delete a Thing (soft delete by default)
181
+ * Hook to fetch available namespaces
212
182
  *
213
- * Automatically invalidates the related cache entries on success.
183
+ * @example
184
+ * ```tsx
185
+ * function NamespaceSelector() {
186
+ * const { data: namespaces, isLoading } = useNamespaces()
214
187
  *
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
188
+ * if (isLoading) return <div>Loading namespaces...</div>
219
189
  *
220
- * Note: DataProvider mode always performs soft delete. For hard delete,
221
- * use RPC or REST API modes with `{ hard: true }` option.
190
+ * return (
191
+ * <select>
192
+ * {namespaces?.map(ns => (
193
+ * <option key={ns.id} value={ns.name}>
194
+ * {ns.name}
195
+ * </option>
196
+ * ))}
197
+ * </select>
198
+ * )
199
+ * }
200
+ * ```
222
201
  */
223
- declare function useDeleteThing(ns: string, type: string, id: string): UseDeleteThingResult;
202
+ declare function useNamespaces(options?: UseNamespacesOptions): UseNamespacesResult;
224
203
 
225
204
  /**
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
205
+ * Options for useTypes hook
232
206
  */
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
- };
207
+ interface UseTypesOptions {
208
+ /** Namespace to fetch types from (defaults to current namespace) */
209
+ ns?: string;
210
+ /** Include hidden/system types */
211
+ includeSystem?: boolean;
212
+ /** Enable/disable the query */
213
+ enabled?: boolean;
214
+ }
265
215
  /**
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)
216
+ * Result from useTypes hook
272
217
  */
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];
218
+ interface UseTypesResult {
219
+ /** List of types */
220
+ data: SemanticType[] | null;
221
+ /** Loading state */
222
+ isLoading: boolean;
223
+ /** Error if any */
224
+ error: Error | null;
225
+ /** Refetch function */
226
+ refetch: () => Promise<unknown>;
227
+ /** Whether data is being refetched */
228
+ isRefetching: boolean;
229
+ /** Query status */
230
+ status: 'pending' | 'error' | 'success';
231
+ }
232
+ declare const typesKeys: {
233
+ all: readonly ["types"];
234
+ list: (ns: string, includeSystem?: boolean) => readonly ["types", "list", string, boolean];
283
235
  };
284
236
  /**
285
- * Query keys for Workflows resource
237
+ * Hook to fetch available types within a namespace
286
238
  *
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
239
+ * @example
240
+ * ```tsx
241
+ * function TypeSelector({ ns }: { ns: string }) {
242
+ * const { data: types, isLoading } = useTypes({ ns })
303
243
  *
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
244
+ * if (isLoading) return <div>Loading types...</div>
245
+ *
246
+ * return (
247
+ * <select>
248
+ * {types?.map(type => (
249
+ * <option key={type.id} value={type.name}>
250
+ * {type.label}
251
+ * </option>
252
+ * ))}
253
+ * </select>
254
+ * )
255
+ * }
256
+ * ```
454
257
  */
455
- declare function useDeleteWorkflow(): UseDeleteWorkflowResult;
258
+ declare function useTypes(options?: UseTypesOptions): UseTypesResult;
456
259
 
457
260
  /**
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
261
+ * Subscription event types
471
262
  */
472
- type UseAgentExecutionsResult = UseQueryResult<PaginatedResult<AgentExecution>, Error>;
263
+ type SubscriptionEventType = 'created' | 'updated' | 'deleted' | 'connected' | 'disconnected' | 'error';
473
264
  /**
474
- * Return type for useAgentExecution hook
265
+ * Subscription event payload
475
266
  */
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>;
267
+ interface SubscriptionEvent {
268
+ /** Event type */
269
+ type: SubscriptionEventType;
270
+ /** Affected Thing (for created/updated/deleted) */
271
+ thing?: Thing;
272
+ /** Thing ID (for deleted events) */
273
+ thingId?: string;
274
+ /** Error message (for error events) */
275
+ error?: string;
276
+ /** Timestamp */
277
+ timestamp: Date;
491
278
  }
492
279
  /**
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
280
+ * Subscription state
527
281
  */
528
- declare function useAgentExecution(id: string): UseAgentExecutionResult;
282
+ type SubscriptionState = 'connecting' | 'connected' | 'disconnected' | 'error';
529
283
  /**
530
- * Hook to create an agent
284
+ * Options for useThingSubscription hook
531
285
  */
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
- */
286
+ interface UseThingSubscriptionOptions {
287
+ /** Namespace to subscribe to */
570
288
  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;
289
+ /** Type to subscribe to (optional, subscribes to all if not specified) */
290
+ type?: string;
291
+ /** Specific Thing ID to subscribe to */
292
+ id?: string;
293
+ /** Filter for subscription */
294
+ filter?: ThingFilter;
295
+ /** Callback when a Thing is created */
296
+ onCreated?: (thing: Thing) => void;
297
+ /** Callback when a Thing is updated */
298
+ onUpdated?: (thing: Thing) => void;
299
+ /** Callback when a Thing is deleted */
300
+ onDeleted?: (thingId: string) => void;
301
+ /** Callback for any event */
302
+ onEvent?: (event: SubscriptionEvent) => void;
303
+ /** Callback for connection state changes */
304
+ onStateChange?: (state: SubscriptionState) => void;
305
+ /** Enable/disable subscription */
306
+ enabled?: boolean;
307
+ /** Auto-invalidate React Query cache on updates */
308
+ invalidateOnUpdate?: boolean;
605
309
  }
606
310
  /**
607
- * Context value for DO Admin specific features (dotdo integration)
311
+ * Result from useThingSubscription hook
608
312
  */
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;
313
+ interface UseThingSubscriptionResult {
314
+ /** Current subscription state */
315
+ state: SubscriptionState;
316
+ /** Recent events (limited buffer) */
317
+ events: SubscriptionEvent[];
318
+ /** Whether currently connected */
319
+ isConnected: boolean;
320
+ /** Last error if any */
321
+ error: Error | null;
322
+ /** Manually reconnect */
323
+ reconnect: () => void;
324
+ /** Disconnect */
325
+ disconnect: () => void;
616
326
  }
617
327
  /**
618
- * Combined admin provider for @mdxui/admin with Durable Objects support.
328
+ * Hook for real-time Thing subscriptions
619
329
  *
620
- * Wraps both the @mdxui/admin AdminProvider and @dotdo/react AdminProvider,
621
- * providing a unified context for admin applications backed by Durable Objects.
330
+ * Subscribes to changes on Things and provides real-time updates.
331
+ * Automatically invalidates React Query cache when data changes.
622
332
  *
623
- * @example
333
+ * @example Subscribe to all Things of a type
624
334
  * ```tsx
625
- * import { DO } from '@mdxui/do'
335
+ * function TaskList() {
336
+ * const { state, events } = useThingSubscription({
337
+ * type: 'Task',
338
+ * onCreated: (task) => console.log('New task:', task),
339
+ * onUpdated: (task) => console.log('Task updated:', task),
340
+ * })
626
341
  *
627
- * function App() {
628
342
  * 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>
343
+ * <div>
344
+ * <div>Status: {state}</div>
345
+ * <div>Recent events: {events.length}</div>
346
+ * </div>
637
347
  * )
638
348
  * }
639
349
  * ```
640
350
  *
641
- * @example
351
+ * @example Subscribe to a specific Thing
642
352
  * ```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,
353
+ * function TaskDetail({ id }: { id: string }) {
354
+ * useThingSubscription({
355
+ * type: 'Task',
356
+ * id,
357
+ * onUpdated: (task) => console.log('Task updated:', task),
651
358
  * })
652
359
  *
653
- * return (
654
- * <DO dataProvider={dataProvider} title="My Admin">
655
- * <AdminRoutes />
656
- * </DO>
657
- * )
360
+ * // ...
658
361
  * }
659
362
  * ```
660
363
  */
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
- }
364
+ declare function useThingSubscription(options?: UseThingSubscriptionOptions): UseThingSubscriptionResult;
665
365
  /**
666
- * Hook to access DO-specific admin context.
366
+ * Hook to subscribe to a single Thing's changes
667
367
  *
668
- * @returns DO context value
368
+ * Convenience wrapper around useThingSubscription for single-Thing use cases.
669
369
  *
670
370
  * @example
671
371
  * ```tsx
672
- * function MyComponent() {
673
- * const { isDOEnabled, ns } = useDOContext()
674
- *
675
- * if (!isDOEnabled) {
676
- * return <div>DO backend not configured</div>
677
- * }
372
+ * function TaskEditor({ ns, type, id }: ThingParams) {
373
+ * const { isConnected, lastUpdate } = useSingleThingSubscription({
374
+ * ns,
375
+ * type,
376
+ * id,
377
+ * onUpdated: (thing) => {
378
+ * // Handle optimistic update conflicts
379
+ * },
380
+ * })
678
381
  *
679
- * return <div>Connected to: {ns}</div>
382
+ * return (
383
+ * <div>
384
+ * {isConnected && <Badge>Live</Badge>}
385
+ * {/* Editor UI *\/}
386
+ * </div>
387
+ * )
680
388
  * }
681
389
  * ```
682
390
  */
683
- declare function useDOContext(): DOAdminContextValue;
391
+ declare function useSingleThingSubscription(options: {
392
+ ns: string;
393
+ type: string;
394
+ id: string;
395
+ onUpdated?: (thing: Thing) => void;
396
+ onDeleted?: () => void;
397
+ enabled?: boolean;
398
+ }): {
399
+ isConnected: boolean;
400
+ lastUpdate: Date | null;
401
+ error: Error | null;
402
+ };
403
+
684
404
  /**
685
- * Hook to check if DO integration is enabled.
686
- *
687
- * @returns Whether DO backend is configured
405
+ * Represents a single edit operation that can be undone/redone
406
+ */
407
+ interface EditOperation {
408
+ /** Type of operation */
409
+ type: 'cell_update';
410
+ /** Row index that was modified */
411
+ rowIndex: number;
412
+ /** Column ID that was modified */
413
+ columnId: string;
414
+ /** Value before the edit */
415
+ oldValue: unknown;
416
+ /** Value after the edit */
417
+ newValue: unknown;
418
+ /** Timestamp of the operation */
419
+ timestamp: number;
420
+ }
421
+ /**
422
+ * Configuration for the edit history hook
688
423
  */
689
- declare function useIsDOEnabled(): boolean;
690
-
424
+ interface UseEditHistoryOptions {
425
+ /** Maximum number of operations to keep in history (default: 50) */
426
+ maxHistory?: number;
427
+ /** Callback when undo is triggered */
428
+ onUndo?: (operation: EditOperation) => void;
429
+ /** Callback when redo is triggered */
430
+ onRedo?: (operation: EditOperation) => void;
431
+ }
691
432
  /**
692
- * useDO Hook
433
+ * Return type for the edit history hook
434
+ */
435
+ interface UseEditHistoryReturn {
436
+ /** Push a new edit operation to history */
437
+ pushOperation: (operation: Omit<EditOperation, 'timestamp'>) => void;
438
+ /** Undo the last operation */
439
+ undo: () => EditOperation | null;
440
+ /** Redo the last undone operation */
441
+ redo: () => EditOperation | null;
442
+ /** Whether undo is available */
443
+ canUndo: boolean;
444
+ /** Whether redo is available */
445
+ canRedo: boolean;
446
+ /** Number of operations that can be undone */
447
+ undoCount: number;
448
+ /** Number of operations that can be redone */
449
+ redoCount: number;
450
+ /** Clear all history */
451
+ clearHistory: () => void;
452
+ }
453
+ /**
454
+ * Custom hook for managing edit history with undo/redo support
693
455
  *
694
- * Wrapper around @dotdo/react/admin useResource that provides
695
- * @mdxui/do-specific defaults and type safety.
456
+ * This hook provides a dual-stack architecture for undo/redo operations,
457
+ * without keyboard shortcuts (use useKeyboardShortcuts separately).
696
458
  *
697
- * @module @mdxui/do/hooks/dotdo
459
+ * @example
460
+ * ```tsx
461
+ * const { pushOperation, undo, redo, canUndo, canRedo } = useEditHistory({
462
+ * onUndo: (op) => updateCell(op.rowIndex, op.columnId, op.oldValue),
463
+ * onRedo: (op) => updateCell(op.rowIndex, op.columnId, op.newValue),
464
+ * })
465
+ *
466
+ * // When a cell is edited:
467
+ * pushOperation({
468
+ * type: 'cell_update',
469
+ * rowIndex: 0,
470
+ * columnId: 'name',
471
+ * oldValue: 'John',
472
+ * newValue: 'Jane',
473
+ * })
474
+ * ```
698
475
  */
476
+ declare function useEditHistory(options?: UseEditHistoryOptions): UseEditHistoryReturn;
699
477
 
700
478
  /**
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;
479
+ * Configuration for a single keyboard shortcut
480
+ */
481
+ interface KeyboardShortcutConfig {
482
+ /** The key to listen for (e.g., 'z', 'y', 'Enter') */
483
+ key: string;
484
+ /** Whether Ctrl key must be pressed (Windows/Linux) */
485
+ ctrl?: boolean;
486
+ /** Whether Shift key must be pressed */
487
+ shift?: boolean;
488
+ /** Whether Meta key must be pressed (Mac Command key) */
489
+ meta?: boolean;
490
+ /** Handler function to call when shortcut is triggered */
491
+ handler: () => void;
492
+ /** Whether this shortcut is disabled */
493
+ disabled?: boolean;
711
494
  }
712
495
  /**
713
- * Configuration for useDO hook
714
- *
715
- * Extends the base @dotdo/react useResource config with
716
- * @mdxui/do-specific options.
496
+ * Options for the useKeyboardShortcuts hook
717
497
  */
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;
498
+ interface UseKeyboardShortcutsOptions {
499
+ /** Whether to enable the shortcuts (default: true) */
500
+ enabled?: boolean;
501
+ /** Whether to prevent default behavior (default: true) */
502
+ preventDefault?: boolean;
503
+ /** Whether to stop propagation (default: false) */
504
+ stopPropagation?: boolean;
733
505
  }
734
506
  /**
735
- * Return type for useDO hook
507
+ * Custom hook for registering global keyboard shortcuts
736
508
  *
737
- * Extends base result with additional @mdxui/do utilities.
509
+ * This hook registers keyboard event listeners on the document and
510
+ * triggers handlers when matching shortcuts are pressed. It automatically
511
+ * bypasses shortcuts when the user is typing in an input, textarea, or
512
+ * contentEditable element.
513
+ *
514
+ * @example
515
+ * ```tsx
516
+ * // Basic undo/redo shortcuts
517
+ * useKeyboardShortcuts([
518
+ * { key: 'z', ctrl: true, handler: handleUndo },
519
+ * { key: 'z', ctrl: true, shift: true, handler: handleRedo },
520
+ * ])
521
+ *
522
+ * // With options
523
+ * useKeyboardShortcuts(
524
+ * [{ key: 's', ctrl: true, handler: handleSave }],
525
+ * { preventDefault: true }
526
+ * )
527
+ *
528
+ * // Conditionally disabled
529
+ * useKeyboardShortcuts(
530
+ * [{ key: 'z', ctrl: true, handler: handleUndo, disabled: !canUndo }],
531
+ * )
532
+ * ```
738
533
  */
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;
534
+ declare function useKeyboardShortcuts(shortcuts: KeyboardShortcutConfig[], options?: UseKeyboardShortcutsOptions): void;
535
+
536
+ interface UseBreadcrumbsOptions {
537
+ /** Label for the root breadcrumb (default: "Admin") */
538
+ rootLabel?: string;
539
+ /** Whether to include root breadcrumb (default: true) */
540
+ includeRoot?: boolean;
756
541
  }
757
542
  /**
758
- * React hook for working with a Durable Objects resource collection.
543
+ * Hook to auto-generate breadcrumbs from the current route
759
544
  *
760
- * Wraps @dotdo/react/admin useResource with @mdxui/do conventions
761
- * and additional utilities.
545
+ * @param options.rootLabel - Label for the root breadcrumb (default: "Admin")
546
+ * @param options.includeRoot - Whether to include root breadcrumb (default: true)
547
+ * @returns Array of breadcrumb items
762
548
  *
763
549
  * @example
764
550
  * ```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
- * )
551
+ * function MyComponent() {
552
+ * const breadcrumbs = useBreadcrumbs()
553
+ * // On /users: [{ label: 'Admin', href: '/' }, { label: 'Users' }]
554
+ * return <Breadcrumbs items={breadcrumbs} LinkComponent={RouterLink} />
788
555
  * }
789
556
  * ```
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
557
  */
799
- declare const useDOAdmin: typeof useDOResource;
558
+ declare function useBreadcrumbs(options?: UseBreadcrumbsOptions): BreadcrumbItemConfig[];
800
559
 
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 };
560
+ export { type EditOperation as CellEditOperation, type KeyboardShortcutConfig, type SchemaDefinition, type SchemaDiscoveryResult, type SchemaProperty, type SubscriptionEvent, type SubscriptionEventType, type SubscriptionState, type UseBreadcrumbsOptions, type UseEditHistoryReturn as UseEditHistoryHookReturn, type UseEditHistoryOptions, type UseKeyboardShortcutsOptions, type UseNamespacesOptions, type UseNamespacesResult, type UseSchemaOptions, type UseSchemaResult, type UseThingSubscriptionOptions, type UseThingSubscriptionResult, type UseTypesOptions, type UseTypesResult, namespacesKeys, schemaKeys, typesKeys, useBreadcrumbs, useEditHistory, useKeyboardShortcuts, useNamespaces, useSchema, useSchemaDefinition, useSingleThingSubscription, useThingSubscription, useTypes };