@exulu/backend 1.46.1 → 1.48.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 (151) hide show
  1. package/.agents/skills/mintlify/SKILL.md +347 -0
  2. package/.editorconfig +15 -0
  3. package/.eslintrc.json +52 -0
  4. package/.jscpd.json +18 -0
  5. package/.prettierignore +5 -0
  6. package/.prettierrc.json +12 -0
  7. package/CHANGELOG.md +2 -2
  8. package/README.md +747 -0
  9. package/SECURITY.md +5 -0
  10. package/dist/index.cjs +11747 -10227
  11. package/dist/index.d.cts +725 -667
  12. package/dist/index.d.ts +725 -667
  13. package/dist/index.js +12043 -10516
  14. package/ee/LICENSE.md +62 -0
  15. package/ee/agentic-retrieval/index.ts +1109 -0
  16. package/ee/documents/THIRD_PARTY_LICENSES/docling.txt +31 -0
  17. package/ee/documents/processing/build_pdf_processor.sh +35 -0
  18. package/ee/documents/processing/chunk_markdown.py +263 -0
  19. package/ee/documents/processing/doc_processor.ts +635 -0
  20. package/ee/documents/processing/pdf_processor.spec +115 -0
  21. package/ee/documents/processing/pdf_to_markdown.py +420 -0
  22. package/ee/documents/processing/requirements.txt +4 -0
  23. package/ee/entitlements.ts +49 -0
  24. package/ee/markdown.ts +686 -0
  25. package/ee/queues/decorator.ts +140 -0
  26. package/ee/queues/queues.ts +156 -0
  27. package/ee/queues/server.ts +6 -0
  28. package/ee/rbac-resolver.ts +51 -0
  29. package/ee/rbac-update.ts +111 -0
  30. package/ee/schemas.ts +348 -0
  31. package/ee/tokenizer.ts +80 -0
  32. package/ee/workers.ts +1423 -0
  33. package/eslint.config.js +88 -0
  34. package/jest.config.ts +25 -0
  35. package/license.md +73 -49
  36. package/mintlify-docs/.mintignore +7 -0
  37. package/mintlify-docs/AGENTS.md +33 -0
  38. package/mintlify-docs/CLAUDE.MD +50 -0
  39. package/mintlify-docs/CONTRIBUTING.md +32 -0
  40. package/mintlify-docs/LICENSE +21 -0
  41. package/mintlify-docs/README.md +55 -0
  42. package/mintlify-docs/ai-tools/claude-code.mdx +43 -0
  43. package/mintlify-docs/ai-tools/cursor.mdx +39 -0
  44. package/mintlify-docs/ai-tools/windsurf.mdx +39 -0
  45. package/mintlify-docs/api-reference/core-types/agent-types.mdx +110 -0
  46. package/mintlify-docs/api-reference/core-types/analytics-types.mdx +95 -0
  47. package/mintlify-docs/api-reference/core-types/configuration-types.mdx +83 -0
  48. package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +106 -0
  49. package/mintlify-docs/api-reference/core-types/job-types.mdx +135 -0
  50. package/mintlify-docs/api-reference/core-types/overview.mdx +73 -0
  51. package/mintlify-docs/api-reference/core-types/prompt-types.mdx +102 -0
  52. package/mintlify-docs/api-reference/core-types/rbac-types.mdx +163 -0
  53. package/mintlify-docs/api-reference/core-types/session-types.mdx +77 -0
  54. package/mintlify-docs/api-reference/core-types/user-management.mdx +112 -0
  55. package/mintlify-docs/api-reference/core-types/workflow-types.mdx +88 -0
  56. package/mintlify-docs/api-reference/core-types.mdx +585 -0
  57. package/mintlify-docs/api-reference/dynamic-types.mdx +851 -0
  58. package/mintlify-docs/api-reference/endpoint/create.mdx +4 -0
  59. package/mintlify-docs/api-reference/endpoint/delete.mdx +4 -0
  60. package/mintlify-docs/api-reference/endpoint/get.mdx +4 -0
  61. package/mintlify-docs/api-reference/endpoint/webhook.mdx +4 -0
  62. package/mintlify-docs/api-reference/introduction.mdx +661 -0
  63. package/mintlify-docs/api-reference/mutations.mdx +1012 -0
  64. package/mintlify-docs/api-reference/openapi.json +217 -0
  65. package/mintlify-docs/api-reference/queries.mdx +1154 -0
  66. package/mintlify-docs/backend/introduction.mdx +218 -0
  67. package/mintlify-docs/changelog.mdx +387 -0
  68. package/mintlify-docs/community-edition.mdx +304 -0
  69. package/mintlify-docs/core/exulu-agent/api-reference.mdx +894 -0
  70. package/mintlify-docs/core/exulu-agent/configuration.mdx +690 -0
  71. package/mintlify-docs/core/exulu-agent/introduction.mdx +552 -0
  72. package/mintlify-docs/core/exulu-app/api-reference.mdx +481 -0
  73. package/mintlify-docs/core/exulu-app/configuration.mdx +319 -0
  74. package/mintlify-docs/core/exulu-app/introduction.mdx +117 -0
  75. package/mintlify-docs/core/exulu-authentication.mdx +810 -0
  76. package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +1011 -0
  77. package/mintlify-docs/core/exulu-chunkers/configuration.mdx +596 -0
  78. package/mintlify-docs/core/exulu-chunkers/introduction.mdx +403 -0
  79. package/mintlify-docs/core/exulu-context/api-reference.mdx +911 -0
  80. package/mintlify-docs/core/exulu-context/configuration.mdx +648 -0
  81. package/mintlify-docs/core/exulu-context/introduction.mdx +394 -0
  82. package/mintlify-docs/core/exulu-database.mdx +811 -0
  83. package/mintlify-docs/core/exulu-default-agents.mdx +545 -0
  84. package/mintlify-docs/core/exulu-eval/api-reference.mdx +772 -0
  85. package/mintlify-docs/core/exulu-eval/configuration.mdx +680 -0
  86. package/mintlify-docs/core/exulu-eval/introduction.mdx +459 -0
  87. package/mintlify-docs/core/exulu-logging.mdx +464 -0
  88. package/mintlify-docs/core/exulu-otel.mdx +670 -0
  89. package/mintlify-docs/core/exulu-queues/api-reference.mdx +648 -0
  90. package/mintlify-docs/core/exulu-queues/configuration.mdx +650 -0
  91. package/mintlify-docs/core/exulu-queues/introduction.mdx +474 -0
  92. package/mintlify-docs/core/exulu-reranker/api-reference.mdx +630 -0
  93. package/mintlify-docs/core/exulu-reranker/configuration.mdx +663 -0
  94. package/mintlify-docs/core/exulu-reranker/introduction.mdx +516 -0
  95. package/mintlify-docs/core/exulu-tool/api-reference.mdx +723 -0
  96. package/mintlify-docs/core/exulu-tool/configuration.mdx +805 -0
  97. package/mintlify-docs/core/exulu-tool/introduction.mdx +539 -0
  98. package/mintlify-docs/core/exulu-variables/api-reference.mdx +699 -0
  99. package/mintlify-docs/core/exulu-variables/configuration.mdx +736 -0
  100. package/mintlify-docs/core/exulu-variables/introduction.mdx +511 -0
  101. package/mintlify-docs/development.mdx +94 -0
  102. package/mintlify-docs/docs.json +248 -0
  103. package/mintlify-docs/enterprise-edition.mdx +538 -0
  104. package/mintlify-docs/essentials/code.mdx +35 -0
  105. package/mintlify-docs/essentials/images.mdx +59 -0
  106. package/mintlify-docs/essentials/markdown.mdx +88 -0
  107. package/mintlify-docs/essentials/navigation.mdx +87 -0
  108. package/mintlify-docs/essentials/reusable-snippets.mdx +110 -0
  109. package/mintlify-docs/essentials/settings.mdx +318 -0
  110. package/mintlify-docs/favicon.svg +3 -0
  111. package/mintlify-docs/frontend/introduction.mdx +39 -0
  112. package/mintlify-docs/getting-started.mdx +267 -0
  113. package/mintlify-docs/guides/custom-agent.mdx +608 -0
  114. package/mintlify-docs/guides/first-agent.mdx +315 -0
  115. package/mintlify-docs/images/admin_ui.png +0 -0
  116. package/mintlify-docs/images/contexts.png +0 -0
  117. package/mintlify-docs/images/create_agents.png +0 -0
  118. package/mintlify-docs/images/evals.png +0 -0
  119. package/mintlify-docs/images/graphql.png +0 -0
  120. package/mintlify-docs/images/graphql_api.png +0 -0
  121. package/mintlify-docs/images/hero-dark.png +0 -0
  122. package/mintlify-docs/images/hero-light.png +0 -0
  123. package/mintlify-docs/images/hero.png +0 -0
  124. package/mintlify-docs/images/knowledge_sources.png +0 -0
  125. package/mintlify-docs/images/mcp.png +0 -0
  126. package/mintlify-docs/images/scaling.png +0 -0
  127. package/mintlify-docs/index.mdx +411 -0
  128. package/mintlify-docs/logo/dark.svg +9 -0
  129. package/mintlify-docs/logo/light.svg +9 -0
  130. package/mintlify-docs/partners.mdx +558 -0
  131. package/mintlify-docs/products.mdx +77 -0
  132. package/mintlify-docs/snippets/snippet-intro.mdx +4 -0
  133. package/mintlify-docs/styles.css +207 -0
  134. package/package.json +35 -4
  135. package/skills-lock.json +10 -0
  136. package/types/context-processor.ts +45 -0
  137. package/types/exulu-table-definition.ts +79 -0
  138. package/types/file-types.ts +18 -0
  139. package/types/models/agent.ts +10 -12
  140. package/types/models/exulu-agent-tool-config.ts +11 -0
  141. package/types/models/rate-limiter-rules.ts +7 -0
  142. package/types/provider-config.ts +21 -0
  143. package/types/queue-config.ts +16 -0
  144. package/types/rbac-rights-modes.ts +1 -0
  145. package/types/statistics.ts +20 -0
  146. package/types/workflow.ts +31 -0
  147. package/changelogs/10.11.2025_03.12.2025.md +0 -316
  148. package/documentation/logging.md +0 -122
  149. package/documentation/otel.md +0 -145
  150. package/types/models/agent-backend.ts +0 -15
  151. /package/{documentation → devops/documentation}/patch-older-releases.md +0 -0
@@ -1,316 +0,0 @@
1
-
2
- ----
3
-
4
- ### feat: add project-scoped context retrieval and enhanced personalization
5
-
6
- Date: 2025-12-03
7
- Author: dclaessen-exulu
8
-
9
- This commit introduces a comprehensive project-based information retrieval
10
- system and several enhancements to the agent and context infrastructure:
11
-
12
- **Project Context Retrieval:**
13
- - Add createProjectRetrievalTool for project-specific information search
14
- across multiple contexts
15
- - Implement project caching mechanism to optimize repeated project queries
16
- - Support hybrid search across project items with filtering and ranking
17
- - Enable automatic project tool injection when session has associated
18
- project
19
-
20
- **Enhanced Personalization:**
21
- - Add firstname/lastname fields to user authentication for API users
22
- - Include user information in system prompts for better personalization
23
- - Make personalization configurable via privacy settings
24
-
25
- **Field Processor Improvements:**
26
- - Add generateEmbeddings configuration option to field processors
27
- - Support onInsert trigger in addition to existing triggers
28
- - Enable processors to run without user context for system operations
29
- - Improve processor execution flow with better logging
30
-
31
- **Infrastructure Enhancements:**
32
- - Add database connection pool logging for debugging
33
- - Improve file parts processing with better error handling
34
- - Make convertToolsArrayToObject async to support dynamic tool generation
35
- - Enhance storage utility to support uploads without user context
36
- - Better handling of tool variable configs vs execution configs
37
- - Comment out unused project_id from RBAC schema
38
-
39
- **Context and Search Improvements:**
40
- - Add search method directly to ExuluContext class
41
- - Expose applyFilters and contextToTableDefinition utilities
42
- - Support context source execution with exuluConfig parameter
43
- - Improve error messages and reduce excessive logging
44
-
45
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
46
-
47
- Co-Authored-By: Claude <noreply@anthropic.com>
48
-
49
- ----
50
-
51
- ### feat: add document parsing for AI agent file handling with JWT secret fix
52
-
53
- Date: 2025-11-30
54
- Author: dclaessen-exulu
55
-
56
- Enhance agent file processing capabilities and fix authentication:
57
-
58
- - Add officeparser integration to extract text from document files
59
- - Implement processFilePartsInMessages to convert file parts to
60
- OpenAI Responses API compatible format
61
- - Convert document files to text parts with extracted content
62
- - Keep image files as image parts (natively supported by API)
63
- - Add message deduplication to prevent duplicate message IDs
64
- - Change saveChat to process messages sequentially for correct
65
- timestamp ordering
66
- - Fix JWT verification in getToken by converting NEXTAUTH_SECRET
67
- to base64url format as required by jose library
68
-
69
- This enables agents to process uploaded documents by extracting
70
- their text content and presenting it in a format compatible with
71
- the OpenAI Responses API.
72
-
73
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
74
-
75
- Co-Authored-By: Claude <noreply@anthropic.com>
76
-
77
- ----
78
-
79
- ### feat: add PDF preview tool and enhance agent API with cookie authentication and message persistence
80
-
81
- Date: 2025-11-26
82
- Author: dclaessen-exulu
83
-
84
- Adds a new preview-pdf tool for viewing PDF documents and significantly enhances the agent
85
- chat API to support public agents with optional authentication. Implements cookie-based session
86
- management, message ID tracking to prevent duplicates during chat persistence, and allows
87
- passing full message arrays for stateless interactions.
88
-
89
- Also downgrades AI SDK from v5.0.95 to v5.0.65 for stability, adds cookie-parser dependency,
90
- and improves context embedding generation with better metadata handling and increased timeout
91
- limits. Enhances S3 integration with multi-bucket support by making the bucket always be the part of the key before the first slash
92
- improves vector search result limits, and adds better error handling for encrypted variables
93
- and external ID lookups in context operations.
94
-
95
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
96
-
97
- Co-Authored-By: Claude <noreply@anthropic.com>
98
-
99
- ----
100
-
101
- ### fix: issue with upsert
102
-
103
- Date: 2025-11-19
104
- Author: dclaessen-exulu
105
-
106
-
107
- ----
108
-
109
- ### feat: upgrade AI SDK to v5.0.95 and add Gemini 3 Pro support with parameterized context sources
110
-
111
- Date: 2025-11-19
112
- Author: dclaessen-exulu
113
-
114
- This commit introduces several enhancements to the AI capabilities and context system:
115
-
116
- - Upgrade AI SDK from v5.0.56 to v5.0.95 with improved provider utilities
117
- - Add @vercel/oidc dependency for enhanced authentication support
118
- - Implement Google Vertex Gemini 3 Pro agent with 1M+ token context window
119
- - Enhance context source configuration with parameterizable inputs
120
- - Improve Vertex authentication documentation with detailed setup instructions
121
- - Add support for dynamic parameters in context source definitions via GraphQL schema
122
-
123
- The new Gemini 3 Pro agent provides very high intelligence with moderate speed,
124
- supporting text, images, files, audio, and video inputs. Context sources can now
125
- define parameters with names, descriptions, and default values for more flexible
126
- data retrieval configurations.
127
-
128
- Changes include:
129
- - src/index.ts: Export new vertexGemini3ProAgent
130
- - src/registry/index.ts: Register Gemini 3 Pro agent
131
- - src/registry/classes.ts: Add params field to ExuluContextSource config
132
- - src/registry/utils/graphql.ts: Add ContextSourceParam type and params support
133
- - src/templates/agents/google/vertex/index.ts: Add Gemini 3 Pro agent, refactor auth docs
134
- - types/models/context.ts: Add params field to Context interface
135
-
136
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
137
-
138
- Co-Authored-By: Claude <noreply@anthropic.com>
139
-
140
- ----
141
-
142
- ### feat: add Google Vertex AI agent support and enhance embedder configuration system
143
-
144
- Date: 2025-11-18
145
- Author: dclaessen-exulu
146
-
147
- Add Google Vertex Gemini 2.5 Flash agent integration with support for
148
- optional authentication. Implement new embedder_settings table for
149
- context-specific embedder configuration with variable management.
150
-
151
- Major changes:
152
- - Add vertexGemini25FlashAgent to default agents and registry
153
- - Implement embedder_settings schema for per-context embedder config
154
- - Add authenticationInformation field to ExuluAgent class
155
- - Make providerapikey optional across agent and MCP initialization
156
- - Add config field to ExuluEmbedder with hydrateEmbedderConfig method
157
- - Pass context ID and settings to embedder chunker and generation ops
158
- - Update GraphQL schema to expose authenticationInformation and config
159
- - Enhance error messages with agent name and ID for better debugging
160
-
161
- Breaking changes:
162
- - ChunkerOperation signature now requires config parameter
163
- - VectorGenerateOperation signature now requires settings parameter
164
- - convertToolsArrayToObject contexts parameter now optional
165
-
166
- This enables agents that don't require API keys (e.g., Vertex AI with
167
- workload identity) and allows embedders to retrieve configuration from
168
- variables per context.
169
-
170
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
171
-
172
- Co-Authored-By: Claude <noreply@anthropic.com>
173
-
174
- ----
175
-
176
- ### fix: project tracking anthropic passthrough and timeout for worker
177
-
178
- Date: 2025-11-17
179
- Author: dclaessen-exulu
180
-
181
-
182
- ----
183
-
184
- ### feat: add MCP prompt library integration and JSON filtering enhancements
185
-
186
- Date: 2025-11-17
187
- Author: dclaessen-exulu
188
-
189
- Add comprehensive prompt template management via MCP tools and enhanced JSON field filtering:
190
-
191
- Prompt Library Features:
192
- - Add prompt_library and prompt_favorites database schemas
193
- - Register getListOfPromptTemplates and getPromptTemplateDetails MCP tools
194
- - Enable agents to discover and retrieve prompt templates with usage/favorite tracking
195
- - Support agent-specific prompt assignment via assigned_agents JSON field
196
-
197
- GraphQL & Filtering Improvements:
198
- - Add JSON field containment support using PostgreSQL @> operator
199
- - Enhance filter operators to handle JSON equality and IN operations with jsonb casting
200
- - Pass table schema context to applyFilters for type-aware query building
201
-
202
- Bug Fixes & Refinements:
203
- - Fix upsert validation to require id or external_id
204
- - Add source update statistics tracking for API and job triggers
205
- - Improve eval function result metadata structure with function_results array
206
- - Add default scoring method fallback to average for eval runs
207
- - Fix typo: rename eval to evaluation in bullmq decorator
208
-
209
- Configuration:
210
- - Add .mcp.json for exulu-mcp-server-default-coding-agent integration
211
-
212
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
213
-
214
- Co-Authored-By: Claude <noreply@anthropic.com>
215
-
216
- ----
217
-
218
- ### feat: add todo system, enhanced roles, session metadata, and scheduling support
219
-
220
- Date: 2025-11-14
221
- Author: dclaessen-exulu
222
-
223
- This commit introduces several significant features and improvements to the Exulu backend:
224
-
225
- - Implement TodoWrite and TodoRead tools for session-based task tracking
226
- - Store todos in agent_sessions.metadata JSON field
227
- - Add access control checks for todo operations
228
- - Tools require authenticated session context
229
-
230
- - Create default "admin" role with full write permissions
231
- - Create "default" role with agent write + read-only for other resources
232
- - Add support for "evals" and "api" permissions in role structure
233
- - Automatically provision both roles during database initialization
234
-
235
- - Add metadata JSON column to agent_sessions table
236
- - Pass sessionID throughout tool execution pipeline
237
- - Implement getSession helper for consistent session retrieval
238
- - Enable session-aware tool execution with user context
239
-
240
- - Add cron-like scheduling support for context data sources
241
- - Implement queue configuration options
242
- - Add retry logic with exponential/linear backoff strategies
243
- - Enable automated data ingestion workflows
244
-
245
- - Fix Redis URL construction when using authentication
246
- - Improve handling of username/password credentials
247
- - Better fallback values for missing environment variables
248
-
249
- - Support config-based tool description overrides
250
- - Pass sessionID to all tool executions
251
- - Enable tools to access session metadata
252
- - Improve tool configuration hydration
253
-
254
- - Add better-auth (v1.3.34) with WebAuthn support
255
- - Include cryptography libraries (@noble/ciphers, @noble/hashes)
256
- - Add @simplewebauthn packages for authentication flows
257
- - Include kysely for type-safe database queries
258
-
259
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
260
-
261
- Co-Authored-By: Claude <noreply@anthropic.com>
262
-
263
- ----
264
-
265
- ### fix: add ExuluItem as export
266
-
267
- Date: 2025-11-11
268
- Author: dclaessen-exulu
269
-
270
-
271
- ----
272
-
273
- ### feat: implement scheduled data sources for contexts
274
-
275
- Date: 2025-11-11
276
- Author: dclaessen-exulu
277
-
278
- Add support for scheduled data sources within ExuluContext that automatically
279
- fetch and ingest items at regular intervals.
280
-
281
- Key changes:
282
- - Introduce ExuluContextSource type with configurable cron schedules, retry
283
- logic, and backoff strategies
284
- - Add source execution handler in BullMQ workers to process scheduled jobs
285
- - Create automatic job schedulers for each context source with configurable
286
- retry attempts (default: 3) and exponential backoff (default: 2000ms)
287
- - Rename Context.process() to processField() for clarity
288
- - Add executeSource() method to handle source execution and item creation
289
- - Track source metadata in BullMQ job data for job identification
290
-
291
- Sources enable automated data ingestion workflows where external data can be
292
- pulled into contexts on a schedule without manual intervention. Each source
293
- execution creates items in the context and optionally schedules follow-up
294
- processing jobs for embeddings and chunking.
295
-
296
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
297
-
298
- Co-Authored-By: Claude <noreply@anthropic.com>
299
-
300
- ----
301
-
302
- ### fix: minor exulu upgrade for redis connection
303
-
304
- Date: 2025-11-10
305
- Author: dclaessen-exulu
306
-
307
-
308
- ----
309
-
310
- ### fix: redis auth url
311
-
312
- Date: 2025-11-10
313
- Author: dclaessen-exulu
314
-
315
-
316
- ----
@@ -1,122 +0,0 @@
1
- # Winston Logger Implementation
2
-
3
- This document describes how winston logging has been integrated into the Exulu backend across Express server, MCP server, and worker instances.
4
-
5
- ## Architecture Overview
6
-
7
- The logging system is centralized through a logger factory function in `src/registry/logger.ts` that creates winston logger instances with conditional OpenTelemetry integration.
8
-
9
- ## Logger Configuration
10
-
11
- ### Core Logger Setup (`src/registry/logger.ts`)
12
-
13
- The `createLogger` function accepts an `enableOtel` boolean parameter to conditionally enable OpenTelemetry transport:
14
-
15
- ```typescript
16
- const createLogger = ({ enableOtel }: { enableOtel: boolean }) => {
17
- const logger = winston.createLogger({
18
- level: 'debug',
19
- format: winston.format.combine(
20
- winston.format.timestamp(),
21
- winston.format.errors({ stack: true }),
22
- winston.format.metadata(),
23
- winston.format.json()
24
- ),
25
- defaultMeta: {
26
- service: 'Exulu',
27
- environment: process.env.NODE_ENV || 'development',
28
- },
29
- transports: [
30
- new winston.transports.Console(),
31
- ...(enableOtel ? [new OpenTelemetryTransportV3()] : []),
32
- ],
33
- })
34
- return logger;
35
- }
36
- ```
37
-
38
- ### Configuration-Driven Telemetry
39
-
40
- The ExuluApp class manages telemetry configuration through the `ExuluConfig` type:
41
-
42
- ```typescript
43
- export type ExuluConfig = {
44
- telemetry?: {
45
- enabled: boolean,
46
- }
47
- workers: {
48
- enabled: boolean,
49
- logsDir?: string,
50
- telemetry?: {
51
- enabled: boolean,
52
- }
53
- }
54
- // ...
55
- }
56
- ```
57
-
58
- ## Integration Points
59
-
60
- ### 1. Express Server Logging
61
-
62
- In `src/registry/index.ts:154-156`, the Express server creates a logger instance:
63
-
64
- ```typescript
65
- const logger = createLogger({
66
- enableOtel: this._config?.telemetry?.enabled ?? false
67
- })
68
- ```
69
-
70
- The logger is then passed to `createExpressRoutes()` for use throughout the Express application.
71
-
72
- ### 2. BullMQ Workers Logging
73
-
74
- In `src/registry/index.ts:123-125`, workers create their own logger instance:
75
-
76
- ```typescript
77
- const logger = createLogger({
78
- enableOtel: this._config?.workers?.telemetry?.enabled ?? false
79
- })
80
- ```
81
-
82
- Workers have separate telemetry configuration allowing independent control of logging transport.
83
-
84
- ### 3. MCP Server Logging
85
-
86
- The MCP server receives the logger instance via dependency injection in `src/mcp/index.ts:31`:
87
-
88
- ```typescript
89
- create = async ({ express, contexts, agents, config, tools, tracer, logger }: {
90
- // ... other params
91
- logger: Logger
92
- }) => {
93
- // Logger is passed in and used throughout MCP server
94
- }
95
- ```
96
-
97
- ## Features
98
-
99
- - **Structured JSON Logging**: All logs are formatted as JSON with timestamps and metadata
100
- - **Error Stack Traces**: Automatic stack trace capture for error objects
101
- - **Environment Context**: Automatic service name and environment labeling
102
- - **Conditional OpenTelemetry**: OTel transport enabled based on configuration
103
- - **Console Fallback**: Always includes console transport for development
104
- - **Instance-Level Control**: Express, Workers, and MCP can have independent telemetry settings
105
-
106
- ## Usage
107
-
108
- Configure telemetry in your ExuluApp config:
109
-
110
- ```typescript
111
- const config: ExuluConfig = {
112
- telemetry: {
113
- enabled: true // Enables OTel for Express and MCP
114
- },
115
- workers: {
116
- enabled: true,
117
- telemetry: {
118
- enabled: false // Workers use console-only logging
119
- }
120
- }
121
- }
122
- ```
@@ -1,145 +0,0 @@
1
- # OpenTelemetry (OTEL) Implementation
2
-
3
- ## Overview
4
-
5
- Exulu has built-in OpenTelemetry support for distributed tracing and logging. OTEL can be enabled/disabled individually for different components (workers, MCP, and Express server) through configuration.
6
-
7
- **Current Support**: The implementation currently supports SigNoz (both Cloud and self-hosted) as the observability backend. Future versions may include support for other OTEL-compatible backends.
8
-
9
- ## Architecture
10
-
11
- ### Core Components
12
-
13
- 1. **ExuluOtel Class** (`src/registry/otel.ts`)
14
- - Factory function that creates a NodeSDK instance
15
- - Configures trace and log exporters for SigNoz
16
- - Sets up automatic instrumentation
17
- - Handles graceful shutdown
18
-
19
- 2. **Configuration** (`src/registry/index.ts`)
20
- - Telemetry can be enabled at the app level and component level
21
- - Each component (workers, MCP, Express) has individual telemetry controls
22
-
23
- ## Usage
24
-
25
- ### Basic Setup
26
-
27
- ```typescript
28
- import { ExuluOtel } from "@exulu/backend";
29
-
30
- const otel = ExuluOtel.create({
31
- SIGNOZ_TRACES_URL: process.env.SIGNOZ_TRACES_URL!,
32
- SIGNOZ_LOGS_URL: process.env.SIGNOZ_LOGS_URL!,
33
- SIGNOZ_ACCESS_TOKEN: process.env.SIGNOZ_ACCESS_TOKEN!
34
- });
35
-
36
- otel.start();
37
- ```
38
-
39
- ### Configuration
40
-
41
- ```typescript
42
- const config: ExuluConfig = {
43
- telemetry: {
44
- enabled: true // Global telemetry switch
45
- },
46
- workers: {
47
- enabled: true,
48
- telemetry: {
49
- enabled: true // Worker-specific telemetry
50
- }
51
- },
52
- MCP: {
53
- enabled: true
54
- // MCP uses global telemetry setting
55
- }
56
- };
57
- ```
58
-
59
- ## Implementation Details
60
-
61
- ### Trace Generation
62
-
63
- When telemetry is enabled, Exulu automatically generates trace spans for:
64
-
65
- - **Express Server Routes** (`src/registry/routes.ts:166`)
66
- - **BullMQ Workers** (`src/registry/workers.ts:133`)
67
- - **MCP Operations** (`src/registry/index.ts:176`)
68
-
69
- ### Tracer Initialization
70
-
71
- ```typescript
72
- // Tracer is created when telemetry is enabled
73
- let tracer: Tracer | undefined;
74
- if (config?.telemetry?.enabled) {
75
- tracer = trace.getTracer("exulu", "1.0.0");
76
- }
77
- ```
78
-
79
- ### SigNoz Integration
80
-
81
- The current implementation is specifically designed for SigNoz integration (supports both SigNoz Cloud and self-hosted deployments):
82
-
83
- - **Service Name**: `Exulu`
84
- - **Traces**: Exported to `SIGNOZ_TRACES_URL`
85
- - **Logs**: Exported to `SIGNOZ_LOGS_URL`
86
- - **Authentication**: Uses `signoz-access-token` header
87
- - **Protocol**: OTLP over HTTP with SigNoz-specific headers
88
-
89
- ### Auto-Instrumentation
90
-
91
- Uses `@opentelemetry/auto-instrumentations-node` for automatic instrumentation of:
92
- - HTTP requests/responses
93
- - Database queries
94
- - File system operations
95
- - And more Node.js modules
96
-
97
- ### Graceful Shutdown
98
-
99
- OTEL SDK automatically shuts down on `SIGTERM` signal:
100
-
101
- ```typescript
102
- process.on('SIGTERM', () => {
103
- sdk.shutdown()
104
- .then(() => console.log('Tracing terminated'))
105
- .catch((error) => console.log('Error terminating tracing', error))
106
- .finally(() => process.exit(0));
107
- });
108
- ```
109
-
110
- ## Environment Variables
111
-
112
- Required environment variables for SigNoz integration:
113
-
114
- - `SIGNOZ_TRACES_URL`: URL for trace export
115
- - `SIGNOZ_LOGS_URL`: URL for log export
116
- - `SIGNOZ_ACCESS_TOKEN`: Authentication token
117
-
118
- ## Component-Level Control
119
-
120
- ### Workers
121
- - Controlled by `config.workers.telemetry.enabled`
122
- - Creates tracer instance when enabled
123
- - Passes tracer to worker creation
124
-
125
- ### Express Server
126
- - Controlled by `config.telemetry.enabled`
127
- - Creates tracer for route instrumentation
128
- - Integrates with logger for structured logging
129
-
130
- ### MCP Server
131
- - Uses global `config.telemetry.enabled` setting
132
- - Receives tracer instance from parent ExuluApp
133
- - Traces MCP protocol operations
134
-
135
- ## Logger Integration
136
-
137
- Each component creates an OTEL-aware logger:
138
-
139
- ```typescript
140
- const logger = createLogger({
141
- enableOtel: config?.telemetry?.enabled ?? false
142
- });
143
- ```
144
-
145
- This enables correlation between traces and structured logs.
@@ -1,15 +0,0 @@
1
- // Represents an agent backend
2
- // which is created and run in
3
- // the agents service. Agents
4
- // registered in Exulu must have
5
- // a connected backend agent that
6
- // does the actual work.
7
- export interface AgentBackend {
8
- id: string
9
- name: string
10
- description: string
11
- enable_batch: boolean
12
- inputSchema: any;
13
- slug: string
14
- type: string
15
- }