@juspay/neurolink 12.13.0 → 12.14.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.
@@ -1,8 +1,12 @@
1
+ import { isProxyOtelOnly } from "./otelLogSink.js";
1
2
  import { chmodSync, closeSync, existsSync, mkdirSync, openSync, statSync, } from "node:fs";
2
3
  import { homedir } from "node:os";
3
4
  import { basename, join } from "node:path";
4
5
  /** Open a restrictive worker log without making proxy startup depend on it. */
5
6
  export function openProxyWorkerLog(filename, logDir = join(homedir(), ".neurolink", "logs")) {
7
+ if (isProxyOtelOnly()) {
8
+ return { stdio: "ignore", close: () => undefined };
9
+ }
6
10
  let fd;
7
11
  try {
8
12
  if (basename(filename) !== filename) {
@@ -644,6 +644,8 @@ export type ProxyBodyCaptureWorkerSnapshot = {
644
644
  lastError?: string;
645
645
  };
646
646
  export type ProxyRequestLoggerSnapshot = {
647
+ diskEnabled?: boolean;
648
+ otel?: ReturnType<typeof import("../proxy/otelLogSink.js").getProxyOtelLogSnapshot>;
647
649
  bodyCapture?: ProxyBodyCaptureWorkerSnapshot;
648
650
  enabled: boolean;
649
651
  requests: ProxyRequestLogSinkSnapshot;
@@ -1685,6 +1687,8 @@ export type ProxyRuntimeSample = {
1685
1687
  };
1686
1688
  /** Data-quality counters for the bounded lifecycle metadata sink. */
1687
1689
  export type ProxyLifecycleLoggerSnapshot = {
1690
+ sink?: "otel" | "file";
1691
+ admissionPolicy?: "best-effort" | "durable-file";
1688
1692
  enabled: boolean;
1689
1693
  schemaVersion: number;
1690
1694
  processInstanceId: string;
@@ -1,4 +1,14 @@
1
1
  import type { JsonObject } from "./common.js";
2
+ /** Options forwarded through `applyAllClients` into a configurator's `apply`. */
3
+ export type CliProxyClientApplyOptions = {
4
+ /**
5
+ * Absolute path of the proxy routing config this process loaded.
6
+ * The Grok writer reads `routing.model-mappings` from this file so a
7
+ * `proxy start --config` catalog matches `/v1/models`. Omit to use
8
+ * `~/.neurolink/proxy-config.yaml`.
9
+ */
10
+ configPath?: string;
11
+ };
2
12
  /**
3
13
  * One AI coding CLI the proxy can point at itself.
4
14
  *
@@ -22,7 +32,7 @@ export type CliProxyClientConfigurator = {
22
32
  * suffix its CLI needs. Returns false when nothing was written, so callers
23
33
  * never print a success message for work that did not happen.
24
34
  */
25
- apply: (proxyBaseUrl: string) => Promise<boolean>;
35
+ apply: (proxyBaseUrl: string, options?: CliProxyClientApplyOptions) => Promise<boolean>;
26
36
  /**
27
37
  * Restore the user's previous configuration. `proxyBaseUrl` is the same bare
28
38
  * origin; a configurator that finds a different URL configured must leave it
@@ -77,6 +87,29 @@ export type CliOpenCodeSnapshot = {
77
87
  /** What the writer last wrote, so apply() can recognise its own block. */
78
88
  written?: unknown;
79
89
  };
90
+ /**
91
+ * One Grok Build picker entry the proxy writer emits under `[model.<id>]`.
92
+ *
93
+ * `contextWindow` is Grok's compaction limit and must be <= the upstream
94
+ * model's window. `supportsReasoningEffort` is false when Grok's `xhigh`
95
+ * would become Anthropic adaptive thinking that the model rejects.
96
+ */
97
+ export type CliGrokProxyModelSpec = {
98
+ id: string;
99
+ name: string;
100
+ apiBackend: "messages" | "chat_completions";
101
+ contextWindow: number;
102
+ maxCompletionTokens: number;
103
+ supportsReasoningEffort: boolean;
104
+ };
105
+ /**
106
+ * Snapshot of whether `~/.grok/config.toml` existed before the proxy wrote
107
+ * its managed block. Persisted to `~/.neurolink/grok-proxy-snapshot.json`.
108
+ */
109
+ export type CliGrokSnapshot = {
110
+ originalExisted: boolean;
111
+ writtenBaseUrl: string;
112
+ };
80
113
  /**
81
114
  * Snapshot of the user's pre-existing Gemini CLI `~/.gemini/.env`.
82
115
  *