@juspay/neurolink 10.12.5 → 10.12.7

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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/browser/neurolink.min.js +329 -329
  3. package/dist/cli/commands/proxy.js +13 -17
  4. package/dist/cli/commands/proxyAnalyze.js +8 -3
  5. package/dist/lib/providers/googleVertex/client.js +9 -1
  6. package/dist/lib/proxy/logCleanupScheduler.d.ts +12 -0
  7. package/dist/lib/proxy/logCleanupScheduler.js +74 -0
  8. package/dist/lib/proxy/logCleanupWorkerEntry.d.ts +1 -0
  9. package/dist/lib/proxy/logCleanupWorkerEntry.js +15 -0
  10. package/dist/lib/proxy/proxyAnalysis.js +6 -0
  11. package/dist/lib/proxy/requestLogger.d.ts +6 -0
  12. package/dist/lib/proxy/requestLogger.js +57 -47
  13. package/dist/lib/proxy/rollingWorkerSupervisor.d.ts +2 -0
  14. package/dist/lib/proxy/rollingWorkerSupervisor.js +40 -2
  15. package/dist/lib/server/routes/claudeProxyRoutes.d.ts +2 -0
  16. package/dist/lib/server/routes/claudeProxyRoutes.js +33 -2
  17. package/dist/lib/types/proxy.d.ts +32 -1
  18. package/dist/lib/utils/messageBuilder.js +12 -0
  19. package/dist/providers/googleVertex/client.js +9 -1
  20. package/dist/proxy/logCleanupScheduler.d.ts +12 -0
  21. package/dist/proxy/logCleanupScheduler.js +73 -0
  22. package/dist/proxy/logCleanupWorkerEntry.d.ts +1 -0
  23. package/dist/proxy/logCleanupWorkerEntry.js +14 -0
  24. package/dist/proxy/proxyAnalysis.js +6 -0
  25. package/dist/proxy/requestLogger.d.ts +6 -0
  26. package/dist/proxy/requestLogger.js +57 -47
  27. package/dist/proxy/rollingWorkerSupervisor.d.ts +2 -0
  28. package/dist/proxy/rollingWorkerSupervisor.js +40 -2
  29. package/dist/server/routes/claudeProxyRoutes.d.ts +2 -0
  30. package/dist/server/routes/claudeProxyRoutes.js +33 -2
  31. package/dist/types/proxy.d.ts +32 -1
  32. package/dist/utils/messageBuilder.js +12 -0
  33. package/package.json +4 -2
@@ -646,6 +646,7 @@ export type AnthropicSuccessResult = {
646
646
  failure?: {
647
647
  message: string;
648
648
  rateLimit: boolean;
649
+ retryDelayMs?: number;
649
650
  };
650
651
  } | {
651
652
  response: Response | unknown;
@@ -702,6 +703,8 @@ export type AnthropicAuthRetryResult = {
702
703
  response?: Response | unknown;
703
704
  holdsAccountAdmission?: boolean;
704
705
  continueLoop: boolean;
706
+ /** Failure-path pacing before rotating after provider-wide overload. */
707
+ retryDelayMs?: number;
705
708
  lastError: unknown;
706
709
  authFailureMessage: string | null;
707
710
  sawRateLimit: boolean;
@@ -713,6 +716,8 @@ export type AnthropicNonOkResult = {
713
716
  response?: Response | unknown;
714
717
  continueLoop: boolean;
715
718
  retrySameAccount?: boolean;
719
+ /** Failure-path pacing before rotating after provider-wide overload. */
720
+ retryDelayMs?: number;
716
721
  lastError: unknown;
717
722
  authFailureMessage: string | null;
718
723
  sawTransientFailure: boolean;
@@ -1457,6 +1462,9 @@ export type ProxyAnalysisReport = {
1457
1462
  attemptLatency: boolean;
1458
1463
  cacheUsage: boolean;
1459
1464
  routingDecisions: boolean;
1465
+ /** True only when every stream needed for cross-stream request/attempt
1466
+ * reconciliation begins at or before the requested analysis window. */
1467
+ comparableRequestAttempts: boolean;
1460
1468
  };
1461
1469
  dataQuality: {
1462
1470
  linesRead: number;
@@ -1468,6 +1476,8 @@ export type ProxyAnalysisReport = {
1468
1476
  observedFrom: string | null;
1469
1477
  observedTo: string | null;
1470
1478
  startsAtOrBeforeRequestedWindow: boolean;
1479
+ /** Whether this stream can support claims covering the full window. */
1480
+ completeWindow: boolean;
1471
1481
  }>;
1472
1482
  bodyArtifacts: {
1473
1483
  capturesIndexed: number;
@@ -2073,6 +2083,14 @@ export type RollingWorkerFailureDetails = {
2073
2083
  workerExitSignal?: string | null;
2074
2084
  supervisorAction?: "none" | "sigkill_after_transfer_failure";
2075
2085
  };
2086
+ export type RollingWorkerSupervisorEvent = {
2087
+ at: string;
2088
+ type: "activated" | "failure" | "failed_transfer" | "rejected_socket";
2089
+ generation: number | null;
2090
+ version: string | null;
2091
+ phase?: "startup" | "activation" | "runtime" | "transfer";
2092
+ reason?: string;
2093
+ };
2076
2094
  export type RollingWorkerSupervisorSnapshot = {
2077
2095
  generation: number;
2078
2096
  active: {
@@ -2093,6 +2111,8 @@ export type RollingWorkerSupervisorSnapshot = {
2093
2111
  queuedSockets: number;
2094
2112
  rejectedSockets: number;
2095
2113
  failedTransfers: number;
2114
+ /** Bounded generation-scoped evidence for attributing lifetime counters. */
2115
+ recentEvents: RollingWorkerSupervisorEvent[];
2096
2116
  lastFailure: ({
2097
2117
  at: string;
2098
2118
  generation: number;
@@ -2305,7 +2325,18 @@ export type ProxyNeurolinkRuntime = {
2305
2325
  neurolink: {
2306
2326
  getToolRegistry(): MCPToolRegistry;
2307
2327
  };
2308
- cleanupLogs: (daysToKeep?: number, maxFiles?: number) => void;
2328
+ logsDir: string;
2329
+ };
2330
+ /** Data passed to the isolated proxy log-retention worker. */
2331
+ export type ProxyLogCleanupWorkerData = {
2332
+ logsDir: string;
2333
+ maxAgeDays: number;
2334
+ maxSizeMb: number;
2335
+ };
2336
+ /** Lifecycle handle for non-blocking proxy log retention. */
2337
+ export type ProxyLogCleanupScheduler = {
2338
+ trigger: () => boolean;
2339
+ stop: () => Promise<void>;
2309
2340
  };
2310
2341
  /** Hono app + readiness state created by the proxy start command. */
2311
2342
  export type ProxyStartApp = {
@@ -1073,6 +1073,18 @@ export async function processUnifiedFilesArray(options, maxSize, provider) {
1073
1073
  options.systemPrompt = existingSystem
1074
1074
  ? `${existingSystem}${filePromptAugmentation}`
1075
1075
  : filePromptAugmentation.trim();
1076
+ // Keep options.prompt in sync with the enriched input.text.
1077
+ // neurolink.ts snapshots `prompt: options.input?.text` at baseOptions
1078
+ // creation — BEFORE this function appends file content — and some
1079
+ // native paths (executeNativeAnthropicGenerate historically) read
1080
+ // `options.prompt` first. Leaving the stale snapshot in place means
1081
+ // every appended file is silently dropped on those paths and the model
1082
+ // answers "no file attached". Same dual-write processCSVFilesForNativeSDK
1083
+ // already documents for exactly this trap.
1084
+ const promptCarrier = options;
1085
+ if (typeof promptCarrier.prompt === "string") {
1086
+ promptCarrier.prompt = inp2.text;
1087
+ }
1076
1088
  }
1077
1089
  });
1078
1090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "10.12.5",
3
+ "version": "10.12.7",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
6
6
  "author": {
@@ -146,6 +146,7 @@
146
146
  "test:anthropic-structured": "npx tsx test/continuous-test-suite-anthropic-structured-tools.ts",
147
147
  "test:sagemaker-tools": "npx tsx test/continuous-test-suite-sagemaker-tools.ts",
148
148
  "test:anthropic-multimodal": "npx tsx test/continuous-test-suite-anthropic-multimodal.ts",
149
+ "test:unified-files-prompt-sync": "npx tsx test/continuous-test-suite-unified-files-prompt-sync.ts",
149
150
  "test:excel-interop": "npx tsx test/continuous-test-suite-excel-interop.ts",
150
151
  "test:envguard": "npx tsx test/helpers/envGuard.test.ts",
151
152
  "test:tool-routing-cli": "npx tsx test/continuous-test-suite-tool-routing-flags.ts && npx tsx test/continuous-test-suite-tool-routing-cli.ts",
@@ -163,7 +164,7 @@
163
164
  "test:system-messages": "npx tsx test/continuous-test-suite-system-messages.ts",
164
165
  "test:test-stubs": "npx tsx test/continuous-test-suite-test-stubs.ts",
165
166
  "test:tool-routing-semantic": "npx tsx test/continuous-test-suite-tool-routing-semantic.ts",
166
- "test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && pnpm run test:file-detector-extension && pnpm run test:file-detector-magic-bytes && pnpm run test:mcp:infra && pnpm run test:mcp:bash && pnpm run test:mcp:limits && pnpm run test:mcp:spans && pnpm run test:autoresearch:redis && pnpm run test:tool-routing && pnpm run test:tool-routing-cli && pnpm run test:tool-dedup && pnpm run test:model-pool && pnpm run test:litellm-context && pnpm run test:dedup-execute-map && pnpm run test:step-budget-guard && pnpm run test:agent-plumbing && pnpm run test:tool-execution-recorder && pnpm run test:proxy-terminal-errors && pnpm run test:proxy-usage-refresh && pnpm run test:system-messages && pnpm run test:tool-routing-semantic && pnpm run test:anthropic-tools-policy && pnpm run test:anthropic-structured && pnpm run test:sagemaker-tools && pnpm run test:anthropic-multimodal && pnpm run test:excel-interop && pnpm run test:model-capabilities && pnpm run test:agent-runtime:vitest && pnpm run test:agent-delegation && pnpm run test:retry-after:vitest && pnpm run test:sampling-params && pnpm run test:structured-recovery && pnpm run test:prompt-redaction && pnpm run test:mcp-result-cache && pnpm run test:test-stubs && pnpm run test:model-not-found-retryable && pnpm run test:websearch-grounding && pnpm run test:archive:security && pnpm run test:office:security",
167
+ "test:unit": "pnpm run test:envguard && pnpm run test:bugfixes && pnpm run test:file-detector-extension && pnpm run test:file-detector-magic-bytes && pnpm run test:mcp:infra && pnpm run test:mcp:bash && pnpm run test:mcp:limits && pnpm run test:mcp:spans && pnpm run test:autoresearch:redis && pnpm run test:tool-routing && pnpm run test:tool-routing-cli && pnpm run test:tool-dedup && pnpm run test:model-pool && pnpm run test:litellm-context && pnpm run test:dedup-execute-map && pnpm run test:step-budget-guard && pnpm run test:agent-plumbing && pnpm run test:tool-execution-recorder && pnpm run test:proxy-terminal-errors && pnpm run test:proxy-usage-refresh && pnpm run test:system-messages && pnpm run test:tool-routing-semantic && pnpm run test:anthropic-tools-policy && pnpm run test:anthropic-structured && pnpm run test:sagemaker-tools && pnpm run test:anthropic-multimodal && pnpm run test:unified-files-prompt-sync && pnpm run test:excel-interop && pnpm run test:model-capabilities && pnpm run test:agent-runtime:vitest && pnpm run test:agent-delegation && pnpm run test:retry-after:vitest && pnpm run test:sampling-params && pnpm run test:structured-recovery && pnpm run test:prompt-redaction && pnpm run test:mcp-result-cache && pnpm run test:test-stubs && pnpm run test:model-not-found-retryable && pnpm run test:websearch-grounding && pnpm run test:archive:security && pnpm run test:office:security && pnpm run test:proxy:vitest",
167
168
  "// CI tier — live providers, runs only when API keys are present (test:credentials and test:dynamic make real provider calls when keys are set, so they live here, not in test:unit)": "",
168
169
  "test:live": "pnpm run test:providers && pnpm run test:mcp:http && pnpm run test:mcp:sdk && pnpm run test:mcp:cli && pnpm run test:observability && pnpm run test:context && pnpm run test:memory && pnpm run test:tool-reliability && pnpm run test:evaluation && pnpm run test:autoresearch && pnpm run test:credentials && pnpm run test:dynamic",
169
170
  "// CI tier — product output (image/video/TTS/PPT) — costs $$ per run": "",
@@ -234,6 +235,7 @@
234
235
  "test:proxy-terminal-errors": "npx tsx test/continuous-test-suite-proxy-terminal-errors.ts",
235
236
  "test:proxy-limit-headers": "npx tsx test/continuous-test-suite-proxy-limit-headers.ts",
236
237
  "test:proxy-usage-refresh": "npx tsx test/continuous-test-suite-proxy-usage-refresh.ts",
238
+ "test:proxy:vitest": "pnpm exec vitest run test/proxyAnalysis.test.ts test/proxyConfigHotReload.test.ts test/proxyObservabilityFoundation.test.ts test/proxyReliabilityHardening.test.ts test/proxyReplay.test.ts test/proxyRollingWorkerHandoff.test.ts test/proxyTestIsolation.test.ts test/proxyUpdaterFallback.test.ts test/proxyUsageStatsPersistence.test.ts",
237
239
  "test:anthropic-limit-capture": "npx tsx test/continuous-test-suite-anthropic-limit-capture.ts",
238
240
  "test:audio": "npx tsx test/continuous-test-suite-audio.ts",
239
241
  "test:file-formats": "npx tsx test/continuous-test-suite-file-formats.ts",