@juspay/neurolink 12.59.0 → 13.0.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.
- package/CHANGELOG.md +3 -3
- package/dist/auth/anthropicOAuth.js +3 -3
- package/dist/auth/middleware/AuthMiddleware.d.ts +1 -1
- package/dist/auth/sessionManager.js +4 -4
- package/dist/auth/tokenStore.js +4 -4
- package/dist/browser/neurolink.min.js +474 -473
- package/dist/cli/commands/observability.d.ts +1 -6
- package/dist/cli/commands/observability.js +0 -106
- package/dist/cli/commands/proxy.js +9 -18
- package/dist/cli/commands/telemetry.d.ts +3 -13
- package/dist/cli/commands/telemetry.js +7 -354
- package/dist/cli/loop/session.js +1 -1
- package/dist/client/httpClient.js +1 -1
- package/dist/client/sseClient.js +1 -1
- package/dist/client/streamingClient.js +2 -2
- package/dist/client/wsClient.js +1 -1
- package/dist/constants/langfuse.d.ts +25 -0
- package/dist/constants/langfuse.js +38 -0
- package/dist/constants/telemetry.d.ts +20 -0
- package/dist/constants/telemetry.js +34 -0
- package/dist/core/baseProvider.d.ts +2 -1
- package/dist/core/baseProvider.js +4 -11
- package/dist/core/conversationMemoryManager.js +5 -8
- package/dist/core/factory.js +1 -1
- package/dist/core/geminiLoopAdapter.d.ts +8 -1
- package/dist/core/geminiLoopAdapter.js +25 -1
- package/dist/core/loopEngine.js +69 -40
- package/dist/core/modules/MessageBuilder.js +2 -2
- package/dist/core/modules/StreamHandler.js +2 -2
- package/dist/core/modules/TelemetryHandler.d.ts +2 -18
- package/dist/core/modules/TelemetryHandler.js +1 -66
- package/dist/core/modules/ToolsManager.js +40 -31
- package/dist/core/nativeGenerateLoop.js +78 -8
- package/dist/core/redisConversationMemoryManager.js +8 -15
- package/dist/core/toolExecutionGuards.js +1 -13
- package/dist/index.d.ts +5 -12
- package/dist/index.js +5 -37
- package/dist/mcp/batching/requestBatcher.js +1 -1
- package/dist/mcp/externalServerManager.js +3 -21
- package/dist/mcp/toolDiscoveryService.js +4 -16
- package/dist/mcp/toolRegistry.js +2 -5
- package/dist/memory/memoryRetrievalTools.js +1 -1
- package/dist/neurolink.d.ts +16 -27
- package/dist/neurolink.js +788 -792
- package/dist/observability/exporterSpanProcessor.d.ts +50 -0
- package/dist/observability/exporterSpanProcessor.js +181 -0
- package/dist/observability/exporters/langfuseExporter.d.ts +13 -34
- package/dist/observability/exporters/langfuseExporter.js +101 -154
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +1 -0
- package/dist/observability/langfuseMasking.d.ts +8 -0
- package/dist/observability/langfuseMasking.js +47 -0
- package/dist/observability/otlpEncoding.d.ts +20 -0
- package/dist/observability/otlpEncoding.js +85 -0
- package/dist/providers/amazonBedrock/client.js +142 -176
- package/dist/providers/amazonBedrock/loopAdapter.js +14 -1
- package/dist/providers/amazonSagemaker.js +118 -80
- package/dist/providers/anthropic/client.js +3 -52
- package/dist/providers/anthropic/loopAdapter.js +24 -1
- package/dist/providers/anthropic/rateLimitCapture.js +9 -12
- package/dist/providers/googleAiStudio/client.d.ts +4 -5
- package/dist/providers/googleAiStudio/client.js +38 -40
- package/dist/providers/googleVertex/client.d.ts +2 -7
- package/dist/providers/googleVertex/client.js +282 -378
- package/dist/providers/googleVertex/constants.js +2 -2
- package/dist/providers/litellm/client.d.ts +2 -9
- package/dist/providers/litellm/client.js +1 -63
- package/dist/providers/openAI/client.d.ts +1 -8
- package/dist/providers/openAI/client.js +0 -65
- package/dist/providers/openaiChatCompletionsBase.d.ts +1 -0
- package/dist/providers/openaiChatCompletionsBase.js +61 -4
- package/dist/providers/replicate.js +22 -4
- package/dist/proxy/codexUsage.js +7 -0
- package/dist/proxy/proxyFetch.js +19 -25
- package/dist/proxy/proxyTracer.d.ts +14 -7
- package/dist/proxy/proxyTracer.js +129 -83
- package/dist/proxy/proxyTranslationEngine.js +0 -1
- package/dist/proxy/requestLogger.d.ts +1 -1
- package/dist/proxy/requestLogger.js +39 -45
- package/dist/server/middleware/auth.d.ts +5 -1
- package/dist/server/middleware/auth.js +10 -3
- package/dist/server/middleware/common.js +1 -1
- package/dist/server/routes/agentRoutes.js +4 -4
- package/dist/server/routes/claudeProxyRoutes.js +99 -196
- package/dist/server/routes/codexProxyRoutes.js +621 -591
- package/dist/server/routes/healthRoutes.js +6 -6
- package/dist/server/routes/mcpRoutes.js +7 -7
- package/dist/server/routes/memoryRoutes.js +7 -7
- package/dist/server/routes/openApiRoutes.js +3 -3
- package/dist/server/routes/toolRoutes.js +5 -5
- package/dist/server/routes/transcribeRoutes.js +1 -1
- package/dist/server/utils/validation.d.ts +3 -3
- package/dist/services/server/ai/observability/instrumentation.d.ts +34 -201
- package/dist/services/server/ai/observability/instrumentation.js +220 -1267
- package/dist/services/server/ai/observability/langfuseSetup.d.ts +14 -0
- package/dist/services/server/ai/observability/langfuseSetup.js +55 -0
- package/dist/services/server/ai/observability/otlpSetup.d.ts +16 -0
- package/dist/services/server/ai/observability/otlpSetup.js +58 -0
- package/dist/session/globalSessionState.js +0 -11
- package/dist/telemetry/attributes.d.ts +23 -46
- package/dist/telemetry/attributes.js +76 -162
- package/dist/telemetry/chatMessages.d.ts +13 -0
- package/dist/telemetry/chatMessages.js +59 -0
- package/dist/telemetry/index.d.ts +5 -19
- package/dist/telemetry/index.js +5 -26
- package/dist/telemetry/observation.d.ts +37 -0
- package/dist/telemetry/observation.js +112 -0
- package/dist/telemetry/observationNames.d.ts +18 -0
- package/dist/telemetry/observationNames.js +24 -0
- package/dist/telemetry/spanSanitizer.d.ts +39 -0
- package/dist/telemetry/spanSanitizer.js +92 -0
- package/dist/telemetry/spanSerialization.d.ts +13 -0
- package/dist/telemetry/spanSerialization.js +46 -0
- package/dist/telemetry/tracers.d.ts +37 -18
- package/dist/telemetry/tracers.js +97 -19
- package/dist/telemetry/withSpan.d.ts +47 -25
- package/dist/telemetry/withSpan.js +158 -71
- package/dist/types/cli.d.ts +0 -11
- package/dist/types/decision.d.ts +3 -0
- package/dist/types/exporter.d.ts +54 -0
- package/dist/types/exporter.js +0 -4
- package/dist/types/generate.d.ts +4 -1
- package/dist/types/isolatedAgent.d.ts +5 -4
- package/dist/types/loopEngine.d.ts +18 -28
- package/dist/types/observability.d.ts +127 -160
- package/dist/types/providers.d.ts +15 -0
- package/dist/types/proxy.d.ts +41 -2
- package/dist/types/server.d.ts +9 -5
- package/dist/utils/anthropicTraceSanitizer.d.ts +2 -2
- package/dist/utils/anthropicTraceSanitizer.js +3 -1
- package/dist/utils/conversationMemory.js +4 -4
- package/dist/utils/fileDetector.js +1 -1
- package/dist/utils/messageBuilder.js +1 -1
- package/dist/utils/noOutputSentinel.d.ts +4 -16
- package/dist/utils/noOutputSentinel.js +12 -28
- package/dist/utils/providerRetry.js +4 -4
- package/dist/voice/livekit/brain.js +1 -1
- package/dist/voice/livekit/realtimeMemory.d.ts +1 -1
- package/dist/voice/livekit/realtimeMemory.js +66 -1
- package/dist/voice/livekit/realtimeVoiceAgent.js +1 -1
- package/docs-site/static/search-index.json +42 -64
- package/package.json +5 -4
- package/dist/telemetry/telemetryService.d.ts +0 -79
- package/dist/telemetry/telemetryService.js +0 -572
- package/dist/utils/observabilityHelpers.d.ts +0 -27
- package/dist/utils/observabilityHelpers.js +0 -47
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LangfuseExporter } from "../../../../observability/exporters/langfuseExporter.js";
|
|
2
|
+
import type { ObservabilityConfig } from "../../../../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* @description Decides whether Langfuse export is on: off when `config.langfuse` is `false`, on when it is an options object or both Langfuse keys are in the environment.
|
|
5
|
+
* @param config {ObservabilityConfig | undefined} - Observability options.
|
|
6
|
+
* @returns {boolean} `true` when a Langfuse exporter should be created.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isLangfuseEnabled(config?: ObservabilityConfig): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @description Builds and starts a Langfuse exporter from config, falling back to the `LANGFUSE_*` environment variables.
|
|
11
|
+
* @param config {ObservabilityConfig | undefined} - Observability options; `langfuse` may carry keys, base URL, environment, release, mask and batching.
|
|
12
|
+
* @returns {LangfuseExporter | null} The exporter, or `null` (after a warning) when the public or secret key is missing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLangfuseExporter(config?: ObservabilityConfig): LangfuseExporter | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OTEL_LOG_PREFIX } from "../../../../constants/telemetry.js";
|
|
2
|
+
import { LangfuseExporter } from "../../../../observability/exporters/langfuseExporter.js";
|
|
3
|
+
import { logger } from "../../../../utils/logger.js";
|
|
4
|
+
async function initializeQuietly(exporter) {
|
|
5
|
+
try {
|
|
6
|
+
await exporter.initialize();
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
logger.warn(`${OTEL_LOG_PREFIX} Langfuse exporter failed to initialize`, {
|
|
10
|
+
error: error instanceof Error ? error.message : String(error),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @description Decides whether Langfuse export is on: off when `config.langfuse` is `false`, on when it is an options object or both Langfuse keys are in the environment.
|
|
16
|
+
* @param config {ObservabilityConfig | undefined} - Observability options.
|
|
17
|
+
* @returns {boolean} `true` when a Langfuse exporter should be created.
|
|
18
|
+
*/
|
|
19
|
+
export function isLangfuseEnabled(config) {
|
|
20
|
+
const langfuse = config?.langfuse;
|
|
21
|
+
if (langfuse === false) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return (typeof langfuse === "object" ||
|
|
25
|
+
Boolean(process.env.LANGFUSE_PUBLIC_KEY && process.env.LANGFUSE_SECRET_KEY));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @description Builds and starts a Langfuse exporter from config, falling back to the `LANGFUSE_*` environment variables.
|
|
29
|
+
* @param config {ObservabilityConfig | undefined} - Observability options; `langfuse` may carry keys, base URL, environment, release, mask and batching.
|
|
30
|
+
* @returns {LangfuseExporter | null} The exporter, or `null` (after a warning) when the public or secret key is missing.
|
|
31
|
+
*/
|
|
32
|
+
export function createLangfuseExporter(config) {
|
|
33
|
+
const options = typeof config?.langfuse === "object" ? config.langfuse : {};
|
|
34
|
+
const publicKey = options.publicKey ?? process.env.LANGFUSE_PUBLIC_KEY;
|
|
35
|
+
const secretKey = options.secretKey ?? process.env.LANGFUSE_SECRET_KEY;
|
|
36
|
+
if (!publicKey || !secretKey) {
|
|
37
|
+
logger.warn(`${OTEL_LOG_PREFIX} Langfuse is enabled but publicKey and secretKey are not both set in config or LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY; not exporting to Langfuse`);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const exporter = new LangfuseExporter({
|
|
41
|
+
enabled: true,
|
|
42
|
+
publicKey,
|
|
43
|
+
secretKey,
|
|
44
|
+
baseUrl: options.baseUrl ?? process.env.LANGFUSE_BASE_URL,
|
|
45
|
+
environment: options.environment,
|
|
46
|
+
release: options.release,
|
|
47
|
+
mask: options.mask,
|
|
48
|
+
maxBufferSize: options.exportMode === "immediate" ? 1 : options.flushAt,
|
|
49
|
+
flushIntervalMs: options.flushInterval === undefined
|
|
50
|
+
? undefined
|
|
51
|
+
: options.flushInterval * 1000,
|
|
52
|
+
});
|
|
53
|
+
void initializeQuietly(exporter);
|
|
54
|
+
return exporter;
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Resource } from "@opentelemetry/resources";
|
|
2
|
+
import { MeterProvider } from "@opentelemetry/sdk-metrics";
|
|
3
|
+
import { type SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
4
|
+
/**
|
|
5
|
+
* @description Builds a batching span processor that ships spans to an OTLP/HTTP endpoint.
|
|
6
|
+
* @param endpoint {string} - OTLP base URL; `/v1/traces` is appended.
|
|
7
|
+
* @returns {SpanProcessor | null} The processor, or `null` (after a warning) when the exporter cannot be created.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createOtlpSpanProcessor(endpoint: string): SpanProcessor | null;
|
|
10
|
+
/**
|
|
11
|
+
* @description Builds a meter provider that exports metrics to an OTLP/HTTP endpoint and registers it as the global meter provider.
|
|
12
|
+
* @param endpoint {string} - OTLP base URL; `/v1/metrics` is appended.
|
|
13
|
+
* @param resource {Resource} - Resource describing the service.
|
|
14
|
+
* @returns {MeterProvider | null} The provider, or `null` (after a warning) when it cannot be created.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createOtlpMeterProvider(endpoint: string, resource: Resource): MeterProvider | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { metrics } from "@opentelemetry/api";
|
|
2
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
3
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
4
|
+
import { MeterProvider, PeriodicExportingMetricReader, } from "@opentelemetry/sdk-metrics";
|
|
5
|
+
import { BatchSpanProcessor, } from "@opentelemetry/sdk-trace-base";
|
|
6
|
+
import { OTEL_LOG_PREFIX } from "../../../../constants/telemetry.js";
|
|
7
|
+
import { logger } from "../../../../utils/logger.js";
|
|
8
|
+
/**
|
|
9
|
+
* @description Builds a batching span processor that ships spans to an OTLP/HTTP endpoint.
|
|
10
|
+
* @param endpoint {string} - OTLP base URL; `/v1/traces` is appended.
|
|
11
|
+
* @returns {SpanProcessor | null} The processor, or `null` (after a warning) when the exporter cannot be created.
|
|
12
|
+
*/
|
|
13
|
+
export function createOtlpSpanProcessor(endpoint) {
|
|
14
|
+
try {
|
|
15
|
+
return new BatchSpanProcessor(new OTLPTraceExporter({ url: `${endpoint}/v1/traces` }), {
|
|
16
|
+
maxQueueSize: 2048,
|
|
17
|
+
maxExportBatchSize: 512,
|
|
18
|
+
scheduledDelayMillis: 1000,
|
|
19
|
+
exportTimeoutMillis: 30000,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger.warn(`${OTEL_LOG_PREFIX} Failed to create OTLP trace exporter`, {
|
|
24
|
+
error: error instanceof Error ? error.message : String(error),
|
|
25
|
+
endpoint,
|
|
26
|
+
});
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @description Builds a meter provider that exports metrics to an OTLP/HTTP endpoint and registers it as the global meter provider.
|
|
32
|
+
* @param endpoint {string} - OTLP base URL; `/v1/metrics` is appended.
|
|
33
|
+
* @param resource {Resource} - Resource describing the service.
|
|
34
|
+
* @returns {MeterProvider | null} The provider, or `null` (after a warning) when it cannot be created.
|
|
35
|
+
*/
|
|
36
|
+
export function createOtlpMeterProvider(endpoint, resource) {
|
|
37
|
+
try {
|
|
38
|
+
const provider = new MeterProvider({
|
|
39
|
+
resource,
|
|
40
|
+
readers: [
|
|
41
|
+
new PeriodicExportingMetricReader({
|
|
42
|
+
exporter: new OTLPMetricExporter({ url: `${endpoint}/v1/metrics` }),
|
|
43
|
+
exportIntervalMillis: 15000,
|
|
44
|
+
exportTimeoutMillis: 10000,
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
metrics.setGlobalMeterProvider(provider);
|
|
49
|
+
return provider;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
logger.warn(`${OTEL_LOG_PREFIX} Failed to create OTLP metric exporter`, {
|
|
53
|
+
error: error instanceof Error ? error.message : String(error),
|
|
54
|
+
endpoint,
|
|
55
|
+
});
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
import { NeuroLink } from "../neurolink.js";
|
|
3
|
-
import { buildObservabilityConfigFromEnv } from "../utils/observabilityHelpers.js";
|
|
4
3
|
/**
|
|
5
4
|
* Build mcp.outputLimits config from environment variables.
|
|
6
5
|
* Reads NEUROLINK_MCP_OUTPUT_STRATEGY and NEUROLINK_MCP_MAX_OUTPUT_BYTES.
|
|
@@ -54,11 +53,6 @@ export class GlobalSessionManager {
|
|
|
54
53
|
maxTurnsPerSession: config.maxTurnsPerSession,
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
|
-
// Add observability config from environment variables (CLI usage)
|
|
58
|
-
const observabilityConfig = buildObservabilityConfigFromEnv();
|
|
59
|
-
if (observabilityConfig) {
|
|
60
|
-
neurolinkOptions.observability = observabilityConfig;
|
|
61
|
-
}
|
|
62
56
|
// Add MCP output limits from environment variables (CLI usage)
|
|
63
57
|
const mcpOutputLimits = buildMcpOutputLimitsFromEnv();
|
|
64
58
|
if (mcpOutputLimits) {
|
|
@@ -187,13 +181,8 @@ export class GlobalSessionManager {
|
|
|
187
181
|
if (session) {
|
|
188
182
|
return session.neurolinkInstance;
|
|
189
183
|
}
|
|
190
|
-
// Create new NeuroLink with observability config from environment (CLI usage)
|
|
191
|
-
const observabilityConfig = buildObservabilityConfigFromEnv();
|
|
192
184
|
const mcpOutputLimits = buildMcpOutputLimitsFromEnv();
|
|
193
185
|
const options = {};
|
|
194
|
-
if (observabilityConfig) {
|
|
195
|
-
options.observability = observabilityConfig;
|
|
196
|
-
}
|
|
197
186
|
if (mcpOutputLimits) {
|
|
198
187
|
options.mcp = { outputLimits: mcpOutputLimits };
|
|
199
188
|
}
|
|
@@ -3,6 +3,7 @@ export declare const ATTR: {
|
|
|
3
3
|
readonly GEN_AI_SYSTEM: "gen_ai.system";
|
|
4
4
|
readonly GEN_AI_MODEL: "gen_ai.request.model";
|
|
5
5
|
readonly GEN_AI_OPERATION: "gen_ai.operation.name";
|
|
6
|
+
readonly GEN_AI_OBSERVATION: "gen_ai.observation.type";
|
|
6
7
|
readonly GEN_AI_INPUT_TOKENS: "gen_ai.usage.input_tokens";
|
|
7
8
|
readonly GEN_AI_OUTPUT_TOKENS: "gen_ai.usage.output_tokens";
|
|
8
9
|
readonly GEN_AI_FINISH_REASON: "gen_ai.response.finish_reason";
|
|
@@ -10,20 +11,20 @@ export declare const ATTR: {
|
|
|
10
11
|
readonly GEN_AI_TOOL_NAME: "gen_ai.tool.name";
|
|
11
12
|
readonly GEN_AI_TEMPERATURE: "gen_ai.request.temperature";
|
|
12
13
|
readonly GEN_AI_MAX_TOKENS: "gen_ai.request.max_tokens";
|
|
13
|
-
readonly NL_PROVIDER: "
|
|
14
|
-
readonly NL_MODEL: "
|
|
15
|
-
readonly NL_STREAM_MODE: "
|
|
16
|
-
readonly NL_TOOL_COUNT: "
|
|
17
|
-
readonly NL_MESSAGE_COUNT: "
|
|
18
|
-
readonly NL_HAS_TOOLS: "
|
|
19
|
-
readonly NL_INPUT_LENGTH: "
|
|
20
|
-
readonly NL_OUTPUT_LENGTH: "
|
|
21
|
-
readonly NL_REQUEST_ID: "
|
|
22
|
-
readonly NL_PATH: "
|
|
23
|
-
readonly NL_HAS_MEMORY: "
|
|
24
|
-
readonly NL_COST: "
|
|
25
|
-
readonly NL_STRUCTURED_OUTPUT: "
|
|
26
|
-
readonly NL_HAS_FALLBACK: "
|
|
14
|
+
readonly NL_PROVIDER: "sdk.provider";
|
|
15
|
+
readonly NL_MODEL: "sdk.model";
|
|
16
|
+
readonly NL_STREAM_MODE: "stream_mode";
|
|
17
|
+
readonly NL_TOOL_COUNT: "tool_count";
|
|
18
|
+
readonly NL_MESSAGE_COUNT: "message_count";
|
|
19
|
+
readonly NL_HAS_TOOLS: "has_tools";
|
|
20
|
+
readonly NL_INPUT_LENGTH: "input_length";
|
|
21
|
+
readonly NL_OUTPUT_LENGTH: "output_length";
|
|
22
|
+
readonly NL_REQUEST_ID: "request_id";
|
|
23
|
+
readonly NL_PATH: "path";
|
|
24
|
+
readonly NL_HAS_MEMORY: "has_conversation_memory";
|
|
25
|
+
readonly NL_COST: "cost";
|
|
26
|
+
readonly NL_STRUCTURED_OUTPUT: "structured_output";
|
|
27
|
+
readonly NL_HAS_FALLBACK: "has_fallback";
|
|
27
28
|
readonly MCP_SERVER_ID: "mcp.server_id";
|
|
28
29
|
readonly MCP_TOOL_NAME: "mcp.tool_name";
|
|
29
30
|
readonly MCP_TIMEOUT_MS: "mcp.timeout_ms";
|
|
@@ -104,30 +105,6 @@ export declare const ATTR: {
|
|
|
104
105
|
readonly AR_DESCRIPTION: "autoresearch.description";
|
|
105
106
|
readonly AR_ERROR_CODE: "autoresearch.error_code";
|
|
106
107
|
};
|
|
107
|
-
/**
|
|
108
|
-
* Langfuse observation/trace attribute names recognised by `@langfuse/otel`'s
|
|
109
|
-
* LangfuseSpanProcessor (already registered on the global TracerProvider). They
|
|
110
|
-
* let native (non-AI-SDK) provider paths emit spans that render as proper
|
|
111
|
-
* generation / tool observations — the same data the Vercel AI SDK's
|
|
112
|
-
* `experimental_telemetry` produced before providers moved to native SDKs.
|
|
113
|
-
*/
|
|
114
|
-
export declare const LANGFUSE_ATTR: {
|
|
115
|
-
readonly TRACE_NAME: "langfuse.trace.name";
|
|
116
|
-
readonly TRACE_INPUT: "langfuse.trace.input";
|
|
117
|
-
readonly TRACE_OUTPUT: "langfuse.trace.output";
|
|
118
|
-
readonly TRACE_TAGS: "langfuse.trace.tags";
|
|
119
|
-
readonly TRACE_METADATA: "langfuse.trace.metadata";
|
|
120
|
-
readonly OBSERVATION_TYPE: "langfuse.observation.type";
|
|
121
|
-
readonly OBSERVATION_INPUT: "langfuse.observation.input";
|
|
122
|
-
readonly OBSERVATION_OUTPUT: "langfuse.observation.output";
|
|
123
|
-
readonly OBSERVATION_METADATA: "langfuse.observation.metadata";
|
|
124
|
-
readonly OBSERVATION_MODEL_NAME: "langfuse.observation.model.name";
|
|
125
|
-
readonly OBSERVATION_MODEL_PARAMETERS: "langfuse.observation.model.parameters";
|
|
126
|
-
readonly OBSERVATION_USAGE_DETAILS: "langfuse.observation.usage_details";
|
|
127
|
-
readonly OBSERVATION_LEVEL: "langfuse.observation.level";
|
|
128
|
-
readonly OBSERVATION_STATUS_MESSAGE: "langfuse.observation.status_message";
|
|
129
|
-
readonly OBSERVATION_COMPLETION_START_TIME: "langfuse.observation.completion_start_time";
|
|
130
|
-
};
|
|
131
108
|
/** Default ceiling for serialized span attribute values. */
|
|
132
109
|
export declare const SPAN_ATTRIBUTE_MAX_CHARS = 40000;
|
|
133
110
|
/**
|
|
@@ -137,12 +114,10 @@ export declare const SPAN_ATTRIBUTE_MAX_CHARS = 40000;
|
|
|
137
114
|
*/
|
|
138
115
|
export declare function spanAttributeMaxChars(): number;
|
|
139
116
|
/**
|
|
140
|
-
* Returns a copy of
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* walked; callers on the tracing path use `spanContentAttribute`, which turns
|
|
145
|
-
* that into an omitted value instead of a leak or a failed turn.
|
|
117
|
+
* @description Returns a copy of a value with credentials masked: values under keys such as `access_token`, `password`, `authorization` or `set-cookie`, bearer tokens, and `name=value` credentials inside text. Purely numeric values after a credential-looking name (e.g. `max_tokens: 4096`) are left alone.
|
|
118
|
+
* @param value {JsonValue | object} - Content to redact; objects and arrays are walked recursively.
|
|
119
|
+
* @returns {JsonValue | object} A redacted copy, serializing exactly as the input when nothing in it is sensitive.
|
|
120
|
+
* @throws {Error} When the value cannot be walked; tracing callers use `spanContentAttribute`, which turns that into an omitted value.
|
|
146
121
|
*/
|
|
147
122
|
export declare function redactSpanContent(value: unknown): unknown;
|
|
148
123
|
/**
|
|
@@ -150,8 +125,10 @@ export declare function redactSpanContent(value: unknown): unknown;
|
|
|
150
125
|
* (arguments, results, answers), with credentials masked first. Use the plain
|
|
151
126
|
* form for metadata such as usage counts and server ids.
|
|
152
127
|
*
|
|
153
|
-
* A structured value over the cap is shortened by
|
|
154
|
-
*
|
|
128
|
+
* A structured value over the cap is shortened by cutting every string to a
|
|
129
|
+
* per-string budget in one walk, tightening the budget only if the result
|
|
130
|
+
* still does not fit, so the attribute stays valid JSON instead of ending
|
|
131
|
+
* mid-token.
|
|
155
132
|
*/
|
|
156
133
|
export declare function spanContentAttribute(value: unknown, maxChars?: number): string;
|
|
157
134
|
/**
|