@juspay/neurolink 9.23.0 → 9.25.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.
- package/CHANGELOG.md +12 -0
- package/README.md +10 -13
- package/dist/adapters/tts/googleTTSHandler.js +26 -1
- package/dist/adapters/video/vertexVideoHandler.js +23 -17
- package/dist/cli/commands/config.d.ts +3 -3
- package/dist/cli/commands/observability.d.ts +53 -0
- package/dist/cli/commands/observability.js +453 -0
- package/dist/cli/commands/telemetry.d.ts +63 -0
- package/dist/cli/commands/telemetry.js +689 -0
- package/dist/cli/factories/commandFactory.d.ts +34 -0
- package/dist/cli/factories/commandFactory.js +321 -116
- package/dist/cli/parser.js +6 -9
- package/dist/cli/utils/formatters.d.ts +13 -0
- package/dist/cli/utils/formatters.js +23 -0
- package/dist/constants/contextWindows.js +6 -0
- package/dist/constants/enums.d.ts +6 -0
- package/dist/constants/enums.js +8 -2
- package/dist/context/budgetChecker.js +75 -48
- package/dist/context/contextCompactor.js +135 -127
- package/dist/core/baseProvider.d.ts +5 -0
- package/dist/core/baseProvider.js +158 -102
- package/dist/core/conversationMemoryInitializer.js +7 -4
- package/dist/core/conversationMemoryManager.d.ts +2 -0
- package/dist/core/conversationMemoryManager.js +6 -2
- package/dist/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/core/modules/GenerationHandler.js +12 -12
- package/dist/evaluation/ragasEvaluator.js +39 -19
- package/dist/evaluation/scoring.js +46 -20
- package/dist/features/ppt/index.d.ts +1 -1
- package/dist/features/ppt/index.js +1 -1
- package/dist/features/ppt/presentationOrchestrator.js +23 -0
- package/dist/features/ppt/slideGenerator.js +13 -0
- package/dist/features/ppt/slideRenderers.d.ts +1 -1
- package/dist/features/ppt/slideRenderers.js +6 -4
- package/dist/features/ppt/slideTypeInference.d.ts +1 -1
- package/dist/features/ppt/slideTypeInference.js +75 -73
- package/dist/files/fileTools.d.ts +6 -6
- package/dist/index.d.ts +46 -12
- package/dist/index.js +79 -17
- package/dist/lib/adapters/tts/googleTTSHandler.js +26 -1
- package/dist/lib/adapters/video/vertexVideoHandler.js +23 -17
- package/dist/lib/constants/contextWindows.js +6 -0
- package/dist/lib/constants/enums.d.ts +6 -0
- package/dist/lib/constants/enums.js +8 -2
- package/dist/lib/context/budgetChecker.js +75 -48
- package/dist/lib/context/contextCompactor.js +135 -127
- package/dist/lib/core/baseProvider.d.ts +5 -0
- package/dist/lib/core/baseProvider.js +158 -102
- package/dist/lib/core/conversationMemoryInitializer.js +7 -4
- package/dist/lib/core/conversationMemoryManager.d.ts +2 -0
- package/dist/lib/core/conversationMemoryManager.js +6 -2
- package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/lib/core/modules/GenerationHandler.js +12 -12
- package/dist/lib/evaluation/ragasEvaluator.js +39 -19
- package/dist/lib/evaluation/scoring.js +46 -20
- package/dist/lib/features/ppt/index.d.ts +1 -1
- package/dist/lib/features/ppt/index.js +1 -1
- package/dist/lib/features/ppt/presentationOrchestrator.js +23 -0
- package/dist/lib/features/ppt/slideGenerator.js +13 -0
- package/dist/lib/features/ppt/slideRenderers.d.ts +1 -1
- package/dist/lib/features/ppt/slideRenderers.js +6 -4
- package/dist/lib/features/ppt/slideTypeInference.d.ts +1 -1
- package/dist/lib/features/ppt/slideTypeInference.js +75 -73
- package/dist/lib/files/fileTools.d.ts +6 -6
- package/dist/lib/index.d.ts +46 -12
- package/dist/lib/index.js +79 -17
- package/dist/lib/mcp/httpRateLimiter.js +39 -12
- package/dist/lib/mcp/httpRetryHandler.js +22 -1
- package/dist/lib/mcp/mcpClientFactory.js +13 -15
- package/dist/lib/memory/memoryRetrievalTools.js +22 -0
- package/dist/lib/neurolink.d.ts +64 -72
- package/dist/lib/neurolink.js +984 -566
- package/dist/lib/observability/exporterRegistry.d.ts +152 -0
- package/dist/lib/observability/exporterRegistry.js +414 -0
- package/dist/lib/observability/exporters/arizeExporter.d.ts +32 -0
- package/dist/lib/observability/exporters/arizeExporter.js +139 -0
- package/dist/lib/observability/exporters/baseExporter.d.ts +117 -0
- package/dist/lib/observability/exporters/baseExporter.js +191 -0
- package/dist/lib/observability/exporters/braintrustExporter.d.ts +30 -0
- package/dist/lib/observability/exporters/braintrustExporter.js +155 -0
- package/dist/lib/observability/exporters/datadogExporter.d.ts +37 -0
- package/dist/lib/observability/exporters/datadogExporter.js +197 -0
- package/dist/lib/observability/exporters/index.d.ts +13 -0
- package/dist/lib/observability/exporters/index.js +14 -0
- package/dist/lib/observability/exporters/laminarExporter.d.ts +48 -0
- package/dist/lib/observability/exporters/laminarExporter.js +303 -0
- package/dist/lib/observability/exporters/langfuseExporter.d.ts +47 -0
- package/dist/lib/observability/exporters/langfuseExporter.js +200 -0
- package/dist/lib/observability/exporters/langsmithExporter.d.ts +26 -0
- package/dist/lib/observability/exporters/langsmithExporter.js +124 -0
- package/dist/lib/observability/exporters/otelExporter.d.ts +39 -0
- package/dist/lib/observability/exporters/otelExporter.js +165 -0
- package/dist/lib/observability/exporters/posthogExporter.d.ts +48 -0
- package/dist/lib/observability/exporters/posthogExporter.js +288 -0
- package/dist/lib/observability/exporters/sentryExporter.d.ts +32 -0
- package/dist/lib/observability/exporters/sentryExporter.js +166 -0
- package/dist/lib/observability/index.d.ts +25 -0
- package/dist/lib/observability/index.js +32 -0
- package/dist/lib/observability/metricsAggregator.d.ts +260 -0
- package/dist/lib/observability/metricsAggregator.js +553 -0
- package/dist/lib/observability/otelBridge.d.ts +49 -0
- package/dist/lib/observability/otelBridge.js +132 -0
- package/dist/lib/observability/retryPolicy.d.ts +192 -0
- package/dist/lib/observability/retryPolicy.js +384 -0
- package/dist/lib/observability/sampling/index.d.ts +4 -0
- package/dist/lib/observability/sampling/index.js +5 -0
- package/dist/lib/observability/sampling/samplers.d.ts +116 -0
- package/dist/lib/observability/sampling/samplers.js +217 -0
- package/dist/lib/observability/spanProcessor.d.ts +129 -0
- package/dist/lib/observability/spanProcessor.js +288 -0
- package/dist/lib/observability/tokenTracker.d.ts +156 -0
- package/dist/lib/observability/tokenTracker.js +414 -0
- package/dist/lib/observability/types/exporterTypes.d.ts +250 -0
- package/dist/lib/observability/types/exporterTypes.js +6 -0
- package/dist/lib/observability/types/index.d.ts +6 -0
- package/dist/lib/observability/types/index.js +5 -0
- package/dist/lib/observability/types/spanTypes.d.ts +244 -0
- package/dist/lib/observability/types/spanTypes.js +93 -0
- package/dist/lib/observability/utils/index.d.ts +4 -0
- package/dist/lib/observability/utils/index.js +5 -0
- package/dist/lib/observability/utils/spanSerializer.d.ts +115 -0
- package/dist/lib/observability/utils/spanSerializer.js +287 -0
- package/dist/lib/providers/amazonSagemaker.d.ts +5 -4
- package/dist/lib/providers/amazonSagemaker.js +3 -4
- package/dist/lib/providers/googleVertex.d.ts +7 -0
- package/dist/lib/providers/googleVertex.js +80 -2
- package/dist/lib/rag/pipeline/RAGPipeline.d.ts +0 -5
- package/dist/lib/rag/pipeline/RAGPipeline.js +122 -87
- package/dist/lib/rag/ragIntegration.js +30 -0
- package/dist/lib/rag/retrieval/hybridSearch.js +22 -0
- package/dist/lib/server/abstract/baseServerAdapter.js +51 -19
- package/dist/lib/server/middleware/common.js +44 -12
- package/dist/lib/services/server/ai/observability/instrumentation.d.ts +2 -2
- package/dist/lib/services/server/ai/observability/instrumentation.js +10 -5
- package/dist/lib/types/cli.d.ts +18 -2
- package/dist/lib/types/conversationMemoryInterface.d.ts +2 -0
- package/dist/lib/types/generateTypes.d.ts +2 -2
- package/dist/lib/types/modelTypes.d.ts +18 -18
- package/dist/lib/types/providers.d.ts +5 -0
- package/dist/lib/utils/pricing.js +25 -1
- package/dist/lib/utils/ttsProcessor.js +74 -59
- package/dist/lib/workflow/config.d.ts +36 -36
- package/dist/lib/workflow/core/ensembleExecutor.js +10 -0
- package/dist/lib/workflow/core/judgeScorer.js +20 -2
- package/dist/lib/workflow/core/workflowRunner.js +34 -1
- package/dist/mcp/httpRateLimiter.js +39 -12
- package/dist/mcp/httpRetryHandler.js +22 -1
- package/dist/mcp/mcpClientFactory.js +13 -15
- package/dist/memory/memoryRetrievalTools.js +22 -0
- package/dist/neurolink.d.ts +64 -72
- package/dist/neurolink.js +984 -566
- package/dist/observability/FEATURE-STATUS.md +269 -0
- package/dist/observability/exporterRegistry.d.ts +152 -0
- package/dist/observability/exporterRegistry.js +413 -0
- package/dist/observability/exporters/arizeExporter.d.ts +32 -0
- package/dist/observability/exporters/arizeExporter.js +138 -0
- package/dist/observability/exporters/baseExporter.d.ts +117 -0
- package/dist/observability/exporters/baseExporter.js +190 -0
- package/dist/observability/exporters/braintrustExporter.d.ts +30 -0
- package/dist/observability/exporters/braintrustExporter.js +154 -0
- package/dist/observability/exporters/datadogExporter.d.ts +37 -0
- package/dist/observability/exporters/datadogExporter.js +196 -0
- package/dist/observability/exporters/index.d.ts +13 -0
- package/dist/observability/exporters/index.js +13 -0
- package/dist/observability/exporters/laminarExporter.d.ts +48 -0
- package/dist/observability/exporters/laminarExporter.js +302 -0
- package/dist/observability/exporters/langfuseExporter.d.ts +47 -0
- package/dist/observability/exporters/langfuseExporter.js +199 -0
- package/dist/observability/exporters/langsmithExporter.d.ts +26 -0
- package/dist/observability/exporters/langsmithExporter.js +123 -0
- package/dist/observability/exporters/otelExporter.d.ts +39 -0
- package/dist/observability/exporters/otelExporter.js +164 -0
- package/dist/observability/exporters/posthogExporter.d.ts +48 -0
- package/dist/observability/exporters/posthogExporter.js +287 -0
- package/dist/observability/exporters/sentryExporter.d.ts +32 -0
- package/dist/observability/exporters/sentryExporter.js +165 -0
- package/dist/observability/index.d.ts +25 -0
- package/dist/observability/index.js +31 -0
- package/dist/observability/metricsAggregator.d.ts +260 -0
- package/dist/observability/metricsAggregator.js +552 -0
- package/dist/observability/otelBridge.d.ts +49 -0
- package/dist/observability/otelBridge.js +131 -0
- package/dist/observability/retryPolicy.d.ts +192 -0
- package/dist/observability/retryPolicy.js +383 -0
- package/dist/observability/sampling/index.d.ts +4 -0
- package/dist/observability/sampling/index.js +4 -0
- package/dist/observability/sampling/samplers.d.ts +116 -0
- package/dist/observability/sampling/samplers.js +216 -0
- package/dist/observability/spanProcessor.d.ts +129 -0
- package/dist/observability/spanProcessor.js +287 -0
- package/dist/observability/tokenTracker.d.ts +156 -0
- package/dist/observability/tokenTracker.js +413 -0
- package/dist/observability/types/exporterTypes.d.ts +250 -0
- package/dist/observability/types/exporterTypes.js +5 -0
- package/dist/observability/types/index.d.ts +6 -0
- package/dist/observability/types/index.js +4 -0
- package/dist/observability/types/spanTypes.d.ts +244 -0
- package/dist/observability/types/spanTypes.js +92 -0
- package/dist/observability/utils/index.d.ts +4 -0
- package/dist/observability/utils/index.js +4 -0
- package/dist/observability/utils/spanSerializer.d.ts +115 -0
- package/dist/observability/utils/spanSerializer.js +286 -0
- package/dist/providers/amazonSagemaker.d.ts +5 -4
- package/dist/providers/amazonSagemaker.js +3 -4
- package/dist/providers/googleVertex.d.ts +7 -0
- package/dist/providers/googleVertex.js +80 -2
- package/dist/rag/pipeline/RAGPipeline.d.ts +0 -5
- package/dist/rag/pipeline/RAGPipeline.js +122 -87
- package/dist/rag/ragIntegration.js +30 -0
- package/dist/rag/retrieval/hybridSearch.js +22 -0
- package/dist/server/abstract/baseServerAdapter.js +51 -19
- package/dist/server/middleware/common.js +44 -12
- package/dist/services/server/ai/observability/instrumentation.d.ts +2 -2
- package/dist/services/server/ai/observability/instrumentation.js +10 -5
- package/dist/types/cli.d.ts +18 -2
- package/dist/types/conversationMemoryInterface.d.ts +2 -0
- package/dist/types/generateTypes.d.ts +2 -2
- package/dist/types/providers.d.ts +5 -0
- package/dist/utils/pricing.js +25 -1
- package/dist/utils/ttsProcessor.js +74 -59
- package/dist/workflow/config.d.ts +52 -52
- package/dist/workflow/core/ensembleExecutor.js +10 -0
- package/dist/workflow/core/judgeScorer.js +20 -2
- package/dist/workflow/core/workflowRunner.js +34 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [9.25.0](https://github.com/juspay/neurolink/compare/v9.24.0...v9.25.0) (2026-03-15)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **(observability):** add OTEL instrumentation, observability exporters, and comprehensive test suite fixes ([66c4559](https://github.com/juspay/neurolink/commit/66c45592cfcf5ae5acbec0513231f48e87044dab))
|
|
6
|
+
|
|
7
|
+
## [9.24.0](https://github.com/juspay/neurolink/compare/v9.23.0...v9.24.0) (2026-03-14)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **(ppt):** Implement CLI support for PPT Gen ([83e6847](https://github.com/juspay/neurolink/commit/83e684781b04562970bcd48f617d368d1c4db2ee))
|
|
12
|
+
|
|
1
13
|
## [9.23.0](https://github.com/juspay/neurolink/compare/v9.22.3...v9.23.0) (2026-03-14)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/README.md
CHANGED
|
@@ -37,19 +37,15 @@ Extracted from production systems at Juspay and battle-tested at enterprise scal
|
|
|
37
37
|
|
|
38
38
|
## What's New (Q1 2026)
|
|
39
39
|
|
|
40
|
-
| Feature | Version | Description | Guide
|
|
41
|
-
| ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
-
| **
|
|
43
|
-
| **
|
|
44
|
-
| **
|
|
45
|
-
| **
|
|
46
|
-
| **
|
|
47
|
-
| **
|
|
48
|
-
| **
|
|
49
|
-
| **Title Generation Events** | v8.38.0 | Emit `conversation:titleGenerated` event when conversation title is generated. Supports custom title prompts via `NEUROLINK_TITLE_PROMPT`. | [Conversation Memory Guide](docs/conversation-memory.md) |
|
|
50
|
-
| **Video Generation with Veo** | v8.32.0 | Video generation using Veo 3.1 (`veo-3.1`). Realistic video generation with many parameter options | [Video Generation Guide](docs/features/video-generation.md) |
|
|
51
|
-
| **Image Generation with Gemini** | v8.31.0 | Native image generation using Gemini 2.0 Flash Experimental (`imagen-3.0-generate-002`). High-quality image synthesis directly from Google AI. | [Image Generation Guide](docs/image-generation-streaming.md) |
|
|
52
|
-
| **HTTP/Streamable HTTP Transport** | v8.29.0 | Connect to remote MCP servers via HTTP with authentication headers, automatic retry with exponential backoff, and configurable rate limiting. | [HTTP Transport Guide](docs/mcp-http-transport.md) |
|
|
40
|
+
| Feature | Version | Description | Guide |
|
|
41
|
+
| ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
42
|
+
| **External TracerProvider Support** | v8.43.0 | Integrate NeuroLink with existing OpenTelemetry instrumentation. Prevents duplicate registration conflicts. | [Observability Guide](docs/features/observability.md) |
|
|
43
|
+
| **Server Adapters** | v8.43.0 | Multi-framework HTTP server with Hono, Express, Fastify, Koa support. Full CLI for server management with foreground/background modes. | [Server Adapters Guide](docs/guides/server-adapters/index.md) |
|
|
44
|
+
| **Title Generation Events** | v8.38.0 | Emit `conversation:titleGenerated` event when conversation title is generated. Supports custom title prompts via `NEUROLINK_TITLE_PROMPT`. | [Conversation Memory Guide](docs/conversation-memory.md) |
|
|
45
|
+
| **Video Generation with Veo** | v8.32.0 | Video generation using Veo 3.1 (`veo-3.1`). Realistic video generation with many parameter options | [Video Generation Guide](docs/features/video-generation.md) |
|
|
46
|
+
| **Image Generation with Gemini** | v8.31.0 | Native image generation using Gemini 2.0 Flash Experimental (`imagen-3.0-generate-002`). High-quality image synthesis directly from Google AI. | [Image Generation Guide](docs/image-generation-streaming.md) |
|
|
47
|
+
| **RAG with generate()/stream()** | v9.2.0 | Pass `rag: { files }` to generate/stream for automatic document chunking, embedding, and AI-powered search. 10 chunking strategies, hybrid search, reranking. | [RAG Guide](docs/features/rag.md) |
|
|
48
|
+
| **HTTP/Streamable HTTP Transport** | v8.29.0 | Connect to remote MCP servers via HTTP with authentication headers, automatic retry with exponential backoff, and configurable rate limiting. | [HTTP Transport Guide](docs/mcp-http-transport.md) |
|
|
53
49
|
|
|
54
50
|
- **Memory** – Per-user condensed memory that persists across all conversations. Automatically retrieves and stores memory on each `generate()`/`stream()` call. Supports S3, Redis, and SQLite storage with LLM-powered condensation. → [Memory Guide](docs/features/memory.md)
|
|
55
51
|
- **External TracerProvider Support** – Integrate NeuroLink with applications that already have OpenTelemetry instrumentation. Supports auto-detection and manual configuration. → [Observability Guide](docs/features/observability.md)
|
|
@@ -57,6 +53,7 @@ Extracted from production systems at Juspay and battle-tested at enterprise scal
|
|
|
57
53
|
- **Title Generation Events** – Emit real-time events when conversation titles are auto-generated. Listen to `conversation:titleGenerated` for session tracking. → [Conversation Memory Guide](docs/conversation-memory.md#title-generation-events)
|
|
58
54
|
- **Custom Title Prompts** – Customize conversation title generation with `NEUROLINK_TITLE_PROMPT` environment variable. Use `${userMessage}` placeholder for dynamic prompts. → [Conversation Memory Guide](docs/conversation-memory.md#customizing-the-title-prompt)
|
|
59
55
|
- **Video Generation** – Transform images into 8-second videos with synchronized audio using Google Veo 3.1 via Vertex AI. Supports 720p/1080p resolutions, portrait/landscape aspect ratios. → [Video Generation Guide](docs/features/video-generation.md)
|
|
56
|
+
- **PPT Generation** – Create professional PowerPoint presentations from text prompts with 35 slide types (title, content, charts, timelines, dashboards, composite layouts), 5 themes, and optional AI-generated images. Works with Vertex AI, OpenAI, Anthropic, Google AI, Azure, and Bedrock. → [PPT Generation Guide](docs/features/ppt-generation.md)
|
|
60
57
|
- **Image Generation** – Generate images from text prompts using Gemini models via Vertex AI or Google AI Studio. Supports streaming mode with automatic file saving. → [Image Generation Guide](docs/image-generation-streaming.md)
|
|
61
58
|
- **RAG with generate()/stream()** – Just pass `rag: { files: ["./docs/guide.md"] }` to `generate()` or `stream()`. NeuroLink auto-chunks, embeds, and creates a search tool the AI can invoke. 10 chunking strategies, hybrid search, 5 reranker types. → [RAG Guide](docs/features/rag.md)
|
|
62
59
|
- **HTTP/Streamable HTTP Transport for MCP** – Connect to remote MCP servers via HTTP with authentication headers, retry logic, and rate limiting. → [HTTP Transport Guide](docs/mcp-http-transport.md)
|
|
@@ -10,6 +10,8 @@ import { TextToSpeechClient } from "@google-cloud/text-to-speech";
|
|
|
10
10
|
import { TTSError, TTS_ERROR_CODES } from "../../utils/ttsProcessor.js";
|
|
11
11
|
import { ErrorCategory, ErrorSeverity } from "../../constants/enums.js";
|
|
12
12
|
import { logger } from "../../utils/logger.js";
|
|
13
|
+
import { SpanSerializer, SpanType, SpanStatus, } from "../../observability/index.js";
|
|
14
|
+
import { getMetricsAggregator } from "../../observability/index.js";
|
|
13
15
|
export class GoogleTTSHandler {
|
|
14
16
|
client = null;
|
|
15
17
|
voicesCache = null;
|
|
@@ -68,18 +70,26 @@ export class GoogleTTSHandler {
|
|
|
68
70
|
retriable: false,
|
|
69
71
|
});
|
|
70
72
|
}
|
|
73
|
+
const span = SpanSerializer.createSpan(SpanType.TTS, "tts.google.listVoices", {
|
|
74
|
+
"tts.operation": "listVoices",
|
|
75
|
+
"tts.provider": "google",
|
|
76
|
+
});
|
|
71
77
|
try {
|
|
72
78
|
// Return cached voices if available, valid, and no language filter is specified
|
|
73
79
|
if (this.voicesCache &&
|
|
74
80
|
Date.now() - this.voicesCache.timestamp <
|
|
75
81
|
GoogleTTSHandler.CACHE_TTL_MS &&
|
|
76
82
|
!languageCode) {
|
|
83
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
84
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
77
85
|
return this.voicesCache.voices;
|
|
78
86
|
}
|
|
79
87
|
// Call Google Cloud listVoices API
|
|
80
88
|
const [response] = await this.client.listVoices(languageCode ? { languageCode } : {});
|
|
81
89
|
if (!response.voices || response.voices.length === 0) {
|
|
82
90
|
logger.warn("Google Cloud TTS returned no voices");
|
|
91
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
92
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
83
93
|
return [];
|
|
84
94
|
}
|
|
85
95
|
const voices = [];
|
|
@@ -118,9 +128,14 @@ export class GoogleTTSHandler {
|
|
|
118
128
|
if (!languageCode) {
|
|
119
129
|
this.voicesCache = { voices, timestamp: Date.now() };
|
|
120
130
|
}
|
|
131
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
132
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
121
133
|
return voices;
|
|
122
134
|
}
|
|
123
135
|
catch (err) {
|
|
136
|
+
// Record error span
|
|
137
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.ERROR, err instanceof Error ? err.message : "Unknown error");
|
|
138
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
124
139
|
// Log error but return empty array for graceful degradation
|
|
125
140
|
const message = err instanceof Error ? err.message : "Unknown error";
|
|
126
141
|
logger.error(`Failed to fetch Google TTS voices: ${message}`);
|
|
@@ -144,6 +159,13 @@ export class GoogleTTSHandler {
|
|
|
144
159
|
retriable: false,
|
|
145
160
|
});
|
|
146
161
|
}
|
|
162
|
+
const voiceId = options.voice ?? "en-US-Neural2-C";
|
|
163
|
+
const span = SpanSerializer.createSpan(SpanType.TTS, "tts.google.synthesize", {
|
|
164
|
+
"tts.operation": "synthesize",
|
|
165
|
+
"tts.provider": "google",
|
|
166
|
+
"tts.voice": voiceId,
|
|
167
|
+
"tts.format": options.format ?? "mp3",
|
|
168
|
+
});
|
|
147
169
|
const startTime = Date.now();
|
|
148
170
|
try {
|
|
149
171
|
const isSSML = text.startsWith("<speak>") && text.endsWith("</speak>");
|
|
@@ -160,7 +182,6 @@ export class GoogleTTSHandler {
|
|
|
160
182
|
retriable: false,
|
|
161
183
|
});
|
|
162
184
|
}
|
|
163
|
-
const voiceId = options.voice ?? "en-US-Neural2-C";
|
|
164
185
|
const languageCode = this.extractLanguageCode(voiceId);
|
|
165
186
|
const audioEncoding = this.mapFormat(options.format ?? "mp3");
|
|
166
187
|
const request = {
|
|
@@ -204,6 +225,8 @@ export class GoogleTTSHandler {
|
|
|
204
225
|
});
|
|
205
226
|
})();
|
|
206
227
|
const latency = Date.now() - startTime;
|
|
228
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
229
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
207
230
|
return {
|
|
208
231
|
buffer,
|
|
209
232
|
format: options.format ?? "mp3",
|
|
@@ -216,6 +239,8 @@ export class GoogleTTSHandler {
|
|
|
216
239
|
};
|
|
217
240
|
}
|
|
218
241
|
catch (err) {
|
|
242
|
+
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.ERROR, err instanceof Error ? err.message : String(err));
|
|
243
|
+
getMetricsAggregator().recordSpan(endedSpan);
|
|
219
244
|
if (err instanceof TTSError) {
|
|
220
245
|
throw err;
|
|
221
246
|
}
|
|
@@ -70,7 +70,14 @@ const DEFAULT_LOCATION = "us-central1";
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
export function isVertexVideoConfigured() {
|
|
73
|
+
// Same credential detection as googleVertex.ts hasGoogleCredentials().
|
|
74
|
+
// GoogleAuth (used by getAccessToken) also supports ADC from
|
|
75
|
+
// `gcloud auth application-default login` automatically, so we only
|
|
76
|
+
// gate on the explicit env vars here — if none are set, we still
|
|
77
|
+
// allow the call through and let GoogleAuth resolve ADC at runtime.
|
|
78
|
+
// This avoids duplicating GoogleAuth's discovery logic.
|
|
73
79
|
return !!(process.env.GOOGLE_APPLICATION_CREDENTIALS ||
|
|
80
|
+
process.env.GOOGLE_APPLICATION_CREDENTIALS_NEUROLINK ||
|
|
74
81
|
process.env.GOOGLE_SERVICE_ACCOUNT_KEY ||
|
|
75
82
|
(process.env.GOOGLE_AUTH_CLIENT_EMAIL &&
|
|
76
83
|
process.env.GOOGLE_AUTH_PRIVATE_KEY));
|
|
@@ -270,21 +277,10 @@ function calculateDimensions(resolution, aspectRatio) {
|
|
|
270
277
|
* ```
|
|
271
278
|
*/
|
|
272
279
|
export async function generateVideoWithVertex(image, prompt, options = {}, region) {
|
|
273
|
-
//
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
message: "Vertex AI credentials not configured. Set GOOGLE_APPLICATION_CREDENTIALS environment variable",
|
|
278
|
-
category: ErrorCategory.CONFIGURATION,
|
|
279
|
-
severity: ErrorSeverity.HIGH,
|
|
280
|
-
retriable: false,
|
|
281
|
-
context: {
|
|
282
|
-
provider: "vertex",
|
|
283
|
-
feature: "video-generation",
|
|
284
|
-
suggestion: "Set GOOGLE_APPLICATION_CREDENTIALS to the path of your service account JSON file",
|
|
285
|
-
},
|
|
286
|
-
});
|
|
287
|
-
}
|
|
280
|
+
// Credential validation is deferred to getAccessToken() which uses
|
|
281
|
+
// GoogleAuth — it handles env vars, service accounts, AND ADC from
|
|
282
|
+
// `gcloud auth application-default login` automatically.
|
|
283
|
+
// Same pattern as googleVertex.ts — no synchronous pre-check needed.
|
|
288
284
|
const config = await getVertexConfig();
|
|
289
285
|
const project = config.project;
|
|
290
286
|
const location = region || config.location;
|
|
@@ -312,7 +308,12 @@ export async function generateVideoWithVertex(image, prompt, options = {}, regio
|
|
|
312
308
|
// Get auth token
|
|
313
309
|
const accessToken = await getAccessToken();
|
|
314
310
|
// Construct API request - predictLongRunning endpoint
|
|
315
|
-
|
|
311
|
+
// Global endpoint uses aiplatform.googleapis.com (no region prefix),
|
|
312
|
+
// same pattern as googleVertex.ts createVertexSettings
|
|
313
|
+
const apiHost = location === "global"
|
|
314
|
+
? "aiplatform.googleapis.com"
|
|
315
|
+
: `${location}-aiplatform.googleapis.com`;
|
|
316
|
+
const endpoint = `https://${apiHost}/v1/projects/${project}/locations/${location}/publishers/google/models/${VEO_MODEL}:predictLongRunning`;
|
|
316
317
|
// Request body structure (verified working from video.js reference)
|
|
317
318
|
const requestBody = {
|
|
318
319
|
instances: [
|
|
@@ -727,7 +728,12 @@ export async function generateTransitionWithVertex(firstFrame, lastFrame, prompt
|
|
|
727
728
|
*/
|
|
728
729
|
async function pollOperation(modelOrEndpoint, operationName, accessToken, project, location, timeoutMs) {
|
|
729
730
|
const startTime = Date.now();
|
|
730
|
-
|
|
731
|
+
// Global endpoint uses aiplatform.googleapis.com (no region prefix),
|
|
732
|
+
// same pattern as the predictLongRunning endpoint at line 374
|
|
733
|
+
const pollHost = location === "global"
|
|
734
|
+
? "aiplatform.googleapis.com"
|
|
735
|
+
: `${location}-aiplatform.googleapis.com`;
|
|
736
|
+
const pollEndpoint = `https://${pollHost}/v1/projects/${project}/locations/${location}/publishers/google/models/${modelOrEndpoint}:fetchPredictOperation`;
|
|
731
737
|
while (Date.now() - startTime < timeoutMs) {
|
|
732
738
|
const result = await makePollRequest(pollEndpoint, operationName, accessToken);
|
|
733
739
|
if (result.done) {
|
|
@@ -60,9 +60,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
60
60
|
}, {
|
|
61
61
|
model?: string | undefined;
|
|
62
62
|
projectId?: string | undefined;
|
|
63
|
-
location?: string | undefined;
|
|
64
63
|
credentials?: string | undefined;
|
|
65
64
|
privateKey?: string | undefined;
|
|
65
|
+
location?: string | undefined;
|
|
66
66
|
serviceAccountKey?: string | undefined;
|
|
67
67
|
clientEmail?: string | undefined;
|
|
68
68
|
}>>;
|
|
@@ -200,9 +200,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
200
200
|
vertex?: {
|
|
201
201
|
model?: string | undefined;
|
|
202
202
|
projectId?: string | undefined;
|
|
203
|
-
location?: string | undefined;
|
|
204
203
|
credentials?: string | undefined;
|
|
205
204
|
privateKey?: string | undefined;
|
|
205
|
+
location?: string | undefined;
|
|
206
206
|
serviceAccountKey?: string | undefined;
|
|
207
207
|
clientEmail?: string | undefined;
|
|
208
208
|
} | undefined;
|
|
@@ -569,9 +569,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
569
569
|
vertex?: {
|
|
570
570
|
model?: string | undefined;
|
|
571
571
|
projectId?: string | undefined;
|
|
572
|
-
location?: string | undefined;
|
|
573
572
|
credentials?: string | undefined;
|
|
574
573
|
privateKey?: string | undefined;
|
|
574
|
+
location?: string | undefined;
|
|
575
575
|
serviceAccountKey?: string | undefined;
|
|
576
576
|
clientEmail?: string | undefined;
|
|
577
577
|
} | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* NeuroLink CLI Observability Commands
|
|
4
|
+
*
|
|
5
|
+
* Commands for monitoring and managing observability features:
|
|
6
|
+
* - status: Show telemetry status
|
|
7
|
+
* - metrics: Show metrics summary
|
|
8
|
+
* - exporters: List configured exporters
|
|
9
|
+
* - costs: Show cost breakdown
|
|
10
|
+
*/
|
|
11
|
+
import type { CommandModule } from "yargs";
|
|
12
|
+
/**
|
|
13
|
+
* Observability command arguments
|
|
14
|
+
*/
|
|
15
|
+
type ObservabilityCommandArgs = {
|
|
16
|
+
format?: "text" | "json" | "table";
|
|
17
|
+
quiet?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type StatusArgs = ObservabilityCommandArgs;
|
|
20
|
+
type MetricsArgs = ObservabilityCommandArgs & {
|
|
21
|
+
detailed?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type ExportersArgs = ObservabilityCommandArgs;
|
|
24
|
+
type CostsArgs = ObservabilityCommandArgs & {
|
|
25
|
+
byModel?: boolean;
|
|
26
|
+
byProvider?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Observability Command Factory
|
|
30
|
+
*/
|
|
31
|
+
export declare class ObservabilityCommandFactory {
|
|
32
|
+
/**
|
|
33
|
+
* Create the observability command group
|
|
34
|
+
*/
|
|
35
|
+
static createObservabilityCommands(): CommandModule<object, object>;
|
|
36
|
+
/**
|
|
37
|
+
* Create the status subcommand
|
|
38
|
+
*/
|
|
39
|
+
static createStatusCommand(): CommandModule<object, StatusArgs>;
|
|
40
|
+
/**
|
|
41
|
+
* Create the metrics subcommand
|
|
42
|
+
*/
|
|
43
|
+
static createMetricsCommand(): CommandModule<object, MetricsArgs>;
|
|
44
|
+
/**
|
|
45
|
+
* Create the exporters subcommand
|
|
46
|
+
*/
|
|
47
|
+
static createExportersCommand(): CommandModule<object, ExportersArgs>;
|
|
48
|
+
/**
|
|
49
|
+
* Create the costs subcommand
|
|
50
|
+
*/
|
|
51
|
+
static createCostsCommand(): CommandModule<object, CostsArgs>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|