-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
299 lines (269 loc) · 6.28 KB
/
index.ts
File metadata and controls
299 lines (269 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// Root package that re-exports all sub-packages
// Export auth-core with namespace to avoid conflicts
export * as AuthCore from './auth-core'
// Export token storage utilities for JWT authentication
export {
clearToken,
getAuthHeader,
getToken,
getValidToken,
handleAuthResponse,
hasValidToken,
storeToken,
} from './auth-core/token-storage'
// Export auth cleanup utilities
export {
clearUserCookies,
clearUserLocalStorage,
clearUserSessionStorage,
listUserData,
performLogoutCleanup,
resetUIState,
} from './auth-core/cleanup'
// Export auth-components
export {
AppSwitcher,
AuthGuard,
AuthProvider,
SignInForm,
SignUpForm,
useAuth,
} from './auth-components'
// Export hooks
export {
useApiError,
useMediaQuery,
useToast,
useUser,
useUserLimits,
type ToastMessage,
} from './hooks'
// Export contexts
export {
// Graph context exports
createGraphContext,
createGraphProvider,
createUseGraphContext,
// Entity context exports
EntityProvider,
GraphContext,
GraphProvider,
// Org context exports
OrgProvider,
// Service offerings context
ServiceOfferingsProvider,
SidebarProvider,
useEntity,
useGraphContext,
useOrg,
useServiceOfferings,
useSidebarContext,
type EntityContextValue,
type EntityProviderProps,
type GraphContextValue,
type GraphProviderProps,
type GraphState,
type OrgContextState,
type OrgContextValue,
type OrgProviderProps,
type ServiceOfferings,
} from './contexts'
// Export lib utilities
export {
clientGraphCookie,
clientSidebarCookie,
entityCookie,
graphCookie,
sidebarCookie,
type EntityCookie,
type GraphCookie,
type SidebarCookie,
} from './lib'
// Export utils
export { generateEntityUri, isUUID, UUID_REGEX } from './utils'
// Export server actions
export {
clearGraphSelection,
getGraphSelection,
persistGraphSelection,
} from './actions/graph-actions'
export {
clearEntitySelection,
getEntitySelection,
persistEntitySelection,
} from './actions/entity-actions'
// Export types
export type { Entities, Entity, User } from './types'
// Export theme
export { customTheme } from './theme'
// Export components
// Export console components
export { ConsoleContent } from './components/console'
export type {
ConsoleCommandContext,
ConsoleConfig,
ConsoleExtraCommand,
ConsoleHeaderConfig,
ConsoleMcpConfig,
ConsoleWelcomeConfig,
SampleQuery,
} from './components/console'
export {
ActiveSubscriptions,
BrowseRepositories,
EntitySelector,
EntitySelectorCore,
GraphSelectorCore,
PageLayout,
RepositoryGuard,
SearchContent,
useIsRepository,
type ActiveSubscriptionsProps,
type BrowseRepositoriesProps,
type EntityGroup,
type EntityLike,
type EntityRecord,
type EntitySelectorProps,
type GraphSelectorProps,
type GraphWithEntities,
type SearchConfig,
type SearchFilterConfig,
type SelectableEntity,
} from './components'
// Export graph filters
export {
composeFilters,
excludeRepositories,
excludeSubgraphs,
GraphFilters,
hasSchemaExtension,
onlyRepositories,
onlyUserGraphs,
} from './components/graph-filters'
// Export app-components
export {
ApiKeyDisplay,
ApiKeysCard,
ApiKeyTable,
categorizeError,
ChatHeader,
ChatInputArea,
// Chat components
ChatMessage,
CoreNavbar,
CoreSidebar,
CreateApiKeyModal,
DeepResearchToggle,
ErrorType,
GeneralInformationCard,
generateMessageId,
getErrorMessage,
PageContainer,
PasswordInformationCard,
PasswordRequirements,
SecureApiKeyField,
SettingsCard,
SettingsContainer,
SettingsFormField,
SettingsPageHeader,
Spinner,
StatusAlert,
SupportModal,
ThemeToggle,
} from './ui-components'
// Export commonly used types
export type {
AgentType,
Message,
SidebarItemData,
SupportMetadata,
} from './ui-components'
// Export library components, types, and helpers
export * from './library'
// Export SDK with namespace to avoid conflicts
export * as SDK from '@robosystems/client'
// Export SDK Clients (available with @robosystems/client v0.3.2+)
export {
clients,
EventType,
executeQuery,
monitorOperation,
OperationClient,
QueryClient,
QueuedQueryError,
RoboSystemsClients,
SSEClient,
streamQuery,
useMultipleOperations,
useOperation,
useQuery,
useSDKClients,
useStreamingQuery,
type OperationMonitorOptions,
type OperationProgress,
type OperationResult,
type QueryOptions,
type QueryRequest,
type QueryResult,
type QueuedQueryResponse,
type RoboSystemsClientConfig,
type SSEConfig,
type SSEEvent,
} from '@robosystems/client/clients'
// Export task monitoring utilities
export {
cancelTask,
getActiveTasks,
pollTaskStatus,
taskMonitor,
} from './task-monitoring/taskMonitor'
export {
getProgressFromStep,
useEntityCreationTask,
useTaskMonitoring,
type UseTaskMonitoringResult,
} from './task-monitoring/hooks'
export type {
TaskCreateResponse,
TaskMonitorState,
TaskPollingOptions,
TaskStatus,
TaskStatusResponse,
} from './task-monitoring'
// Export operation monitoring hooks
export {
useGraphCreation,
useOperationMonitoring,
useRepositorySubscription,
type OperationMonitorState,
type UseOperationMonitoringResult,
} from './task-monitoring/operationHooks'
// Configure and export client directly for convenience (since it's commonly used)
import { client } from '@robosystems/client'
import { getAuthHeader } from './auth-core/token-storage'
// Configure the SDK client with default settings
// Skip configuration in test environment to prevent connection attempts
if (process.env.NODE_ENV !== 'test') {
client.setConfig({
baseUrl:
process.env.NEXT_PUBLIC_ROBOSYSTEMS_API_URL || 'http://localhost:8000',
// No longer using credentials: 'include' for cookies
// Using Bearer token authentication instead
headers: {
'Content-Type': 'application/json',
},
})
// Add Bearer token to all requests if authenticated
client.interceptors.request.use(async (request) => {
const authHeader = getAuthHeader()
if (authHeader) {
request.headers.set('Authorization', authHeader)
}
return request
})
}
export { client }
// For backward compatibility, also export the main auth types directly
export type { APIKey, AppName, AuthContextType, AuthUser } from './auth-core'
// App identity
export { CURRENT_APP } from './auth-core/config'