@peopl-health/nexus 2.3.1 → 2.3.3
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.
- package/CHANGELOG.md +0 -0
- package/LICENSE +0 -0
- package/MIGRATION_GUIDE.md +0 -0
- package/README.md +0 -0
- package/examples/.env.example +0 -0
- package/examples/assistants/BaseAssistant.js +0 -0
- package/examples/assistants/DoctorScheduleAssistant.js +0 -0
- package/examples/assistants/ExampleAssistant.js +0 -0
- package/examples/assistants/index.js +0 -0
- package/examples/basic-usage.js +0 -0
- package/examples/consumer-server.js +0 -0
- package/examples/test-batching.js +0 -0
- package/lib/adapters/BaileysProvider.js +0 -0
- package/lib/adapters/TwilioProvider.js +0 -0
- package/lib/adapters/index.js +0 -0
- package/lib/adapters/registry.js +0 -0
- package/lib/assistants/BaseAssistant.js +0 -0
- package/lib/assistants/index.js +0 -0
- package/lib/config/airtableConfig.js +0 -0
- package/lib/config/awsConfig.js +0 -0
- package/lib/config/configLoader.js +0 -0
- package/lib/config/interactionConfig.js +0 -0
- package/lib/config/llmConfig.js +0 -0
- package/lib/config/mongoAuthConfig.js +0 -0
- package/lib/config/runtimeConfig.js +0 -0
- package/lib/controllers/assistantController.js +0 -0
- package/lib/controllers/bugReportController.js +0 -0
- package/lib/controllers/conversationController.js +0 -0
- package/lib/controllers/interactionController.js +0 -0
- package/lib/controllers/mediaController.js +0 -0
- package/lib/controllers/messageController.js +0 -0
- package/lib/controllers/patientController.js +0 -0
- package/lib/controllers/qualityMessageController.js +0 -0
- package/lib/controllers/templateController.js +0 -0
- package/lib/controllers/templateFlowController.js +0 -0
- package/lib/controllers/uploadController.js +0 -0
- package/lib/core/MessageProvider.js +0 -0
- package/lib/core/NexusMessaging.js +0 -0
- package/lib/core/index.js +0 -0
- package/lib/helpers/assistantHelper.js +0 -0
- package/lib/helpers/baileysHelper.js +0 -0
- package/lib/helpers/filesHelper.js +0 -0
- package/lib/helpers/llmsHelper.js +0 -0
- package/lib/helpers/mediaHelper.js +0 -0
- package/lib/helpers/messageHelper.js +0 -0
- package/lib/helpers/mongoHelper.js +0 -0
- package/lib/helpers/processHelper.js +0 -0
- package/lib/helpers/qrHelper.js +0 -0
- package/lib/helpers/threadHelper.js +0 -0
- package/lib/helpers/twilioHelper.js +0 -0
- package/lib/helpers/twilioMediaProcessor.js +0 -0
- package/lib/helpers/whatsappHelper.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/interactive/index.js +0 -0
- package/lib/interactive/registry.js +0 -0
- package/lib/interactive/twilioMapper.js +0 -0
- package/lib/models/agendaMessageModel.js +0 -0
- package/lib/models/index.js +0 -0
- package/lib/models/interactionModel.js +0 -0
- package/lib/models/messageModel.js +0 -0
- package/lib/models/qualityMessageModel.js +0 -0
- package/lib/models/templateModel.js +0 -0
- package/lib/models/threadModel.js +0 -0
- package/lib/observability/index.js +0 -0
- package/lib/observability/telemetry.js +30 -9
- package/lib/providers/OpenAIAssistantsProvider.js +0 -0
- package/lib/providers/OpenAIResponsesProvider.js +0 -0
- package/lib/providers/OpenAIResponsesProviderTools.js +0 -0
- package/lib/providers/createProvider.js +0 -0
- package/lib/routes/index.js +0 -0
- package/lib/services/airtableService.js +0 -0
- package/lib/services/assistantService.js +0 -0
- package/lib/services/conversationService.js +0 -0
- package/lib/services/preprocessingHooks.js +0 -0
- package/lib/services/twilioService.js +0 -0
- package/lib/storage/MongoStorage.js +0 -0
- package/lib/storage/NoopStorage.js +0 -0
- package/lib/storage/index.js +0 -0
- package/lib/storage/registry.js +0 -0
- package/lib/templates/predefinedTemplates.js +0 -0
- package/lib/templates/templateStructure.js +0 -0
- package/lib/utils/dateUtils.js +0 -0
- package/lib/utils/errorHandler.js +0 -0
- package/lib/utils/index.js +0 -0
- package/lib/utils/logger.js +0 -0
- package/lib/utils/mediaValidator.js +0 -0
- package/lib/utils/messageParser.js +0 -0
- package/lib/utils/retryHelper.js +0 -0
- package/lib/utils/sanitizer.js +0 -0
- package/lib/utils/tracingDecorator.js +0 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/MIGRATION_GUIDE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/examples/.env.example
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/examples/basic-usage.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/adapters/index.js
CHANGED
|
File without changes
|
package/lib/adapters/registry.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/assistants/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/config/awsConfig.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/config/llmConfig.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/core/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/helpers/qrHelper.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/interactive/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/models/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,10 @@ const { NodeSDK } = require('@opentelemetry/sdk-node');
|
|
|
2
2
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
|
3
3
|
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
|
|
4
4
|
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
|
|
5
|
+
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
|
5
6
|
const { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-node');
|
|
7
|
+
const { Resource } = require('@opentelemetry/resources');
|
|
8
|
+
const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = require('@opentelemetry/semantic-conventions');
|
|
6
9
|
|
|
7
10
|
class TelemetryManager {
|
|
8
11
|
constructor() {
|
|
@@ -20,26 +23,43 @@ class TelemetryManager {
|
|
|
20
23
|
serviceName = 'nexus-assistant',
|
|
21
24
|
serviceVersion = '1.0.0',
|
|
22
25
|
jaegerEndpoint = 'http://localhost:14268/api/traces',
|
|
26
|
+
otlpEndpoint = null,
|
|
27
|
+
otlpHeaders = {},
|
|
23
28
|
prometheusEndpoint = '/metrics',
|
|
24
29
|
prometheusPort = 9090
|
|
25
30
|
} = config;
|
|
26
31
|
|
|
27
32
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// Create resource with service information
|
|
34
|
+
const resource = new Resource({
|
|
35
|
+
[ATTR_SERVICE_NAME]: serviceName,
|
|
36
|
+
[ATTR_SERVICE_VERSION]: serviceVersion,
|
|
37
|
+
});
|
|
30
38
|
|
|
31
39
|
const prometheusExporter = new PrometheusExporter({
|
|
32
40
|
endpoint: prometheusEndpoint,
|
|
33
41
|
port: prometheusPort,
|
|
34
42
|
});
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
// Use OTLP exporter for Grafana Cloud (with auth), or Jaeger for local
|
|
45
|
+
let traceExporter;
|
|
46
|
+
if (otlpEndpoint) {
|
|
47
|
+
traceExporter = new OTLPTraceExporter({
|
|
48
|
+
url: otlpEndpoint,
|
|
49
|
+
headers: otlpHeaders,
|
|
50
|
+
timeoutMillis: 10000,
|
|
51
|
+
});
|
|
52
|
+
console.log('🌐 Using OTLP exporter for cloud tracing');
|
|
53
|
+
} else {
|
|
54
|
+
traceExporter = new JaegerExporter({
|
|
55
|
+
endpoint: jaegerEndpoint,
|
|
56
|
+
tags: [],
|
|
57
|
+
timeout: 10000,
|
|
58
|
+
});
|
|
59
|
+
console.log('🏠 Using Jaeger exporter for local tracing');
|
|
60
|
+
}
|
|
41
61
|
|
|
42
|
-
const batchSpanProcessor = new BatchSpanProcessor(
|
|
62
|
+
const batchSpanProcessor = new BatchSpanProcessor(traceExporter, {
|
|
43
63
|
maxExportBatchSize: process.env.NODE_ENV === 'production' ? 50 : 10,
|
|
44
64
|
maxQueueSize: process.env.NODE_ENV === 'production' ? 2048 : 100,
|
|
45
65
|
exportTimeoutMillis: process.env.NODE_ENV === 'production' ? 5000 : 2000,
|
|
@@ -47,6 +67,7 @@ class TelemetryManager {
|
|
|
47
67
|
});
|
|
48
68
|
|
|
49
69
|
this.sdk = new NodeSDK({
|
|
70
|
+
resource: resource,
|
|
50
71
|
instrumentations: [getNodeAutoInstrumentations({
|
|
51
72
|
'@opentelemetry/instrumentation-fs': {
|
|
52
73
|
enabled: false,
|
|
@@ -85,7 +106,7 @@ class TelemetryManager {
|
|
|
85
106
|
|
|
86
107
|
console.log(`🚀 OpenTelemetry initialized for "${serviceName}"`);
|
|
87
108
|
console.log(`📊 Metrics available at: http://localhost:${prometheusPort}${prometheusEndpoint}`);
|
|
88
|
-
console.log(`🔍 Traces sent to: ${jaegerEndpoint}`);
|
|
109
|
+
console.log(`🔍 Traces sent to: ${otlpEndpoint || jaegerEndpoint}`);
|
|
89
110
|
|
|
90
111
|
} catch (error) {
|
|
91
112
|
console.error('❌ Failed to initialize OpenTelemetry:', error.message);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/routes/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/storage/index.js
CHANGED
|
File without changes
|
package/lib/storage/registry.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/dateUtils.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/utils/index.js
CHANGED
|
File without changes
|
package/lib/utils/logger.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/retryHelper.js
CHANGED
|
File without changes
|
package/lib/utils/sanitizer.js
CHANGED
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peopl-health/nexus",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Core messaging and assistant library for WhatsApp communication platforms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@opentelemetry/auto-instrumentations-node": "0.67.0",
|
|
79
79
|
"@opentelemetry/exporter-jaeger": "2.2.0",
|
|
80
80
|
"@opentelemetry/exporter-prometheus": "0.208.0",
|
|
81
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.56.0",
|
|
81
82
|
"@opentelemetry/resources": "2.2.0",
|
|
82
83
|
"@opentelemetry/sdk-node": "0.208.0",
|
|
83
84
|
"@opentelemetry/sdk-trace-node": "2.2.0",
|