@juspay/neurolink 12.7.0 → 12.7.2

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 CHANGED
@@ -1,12 +1,8 @@
1
- ## [12.7.0](https://github.com/juspay/neurolink/compare/v12.6.1...v12.7.0) (2026-08-29)
2
-
3
- ### Features
4
-
5
- - **(tts):** stream OpenAI audio natively ([dca67fa](https://github.com/juspay/neurolink/commit/dca67fa452ac571d308a3e15da5a100803b27010))
1
+ ## [12.7.2](https://github.com/juspay/neurolink/compare/v12.7.1...v12.7.2) (2026-08-29)
6
2
 
7
3
  ### Bug Fixes
8
4
 
9
- - **(proxy):** correct how the MSIE User-Agent was attributed, and guard the roster ([4e909f9](https://github.com/juspay/neurolink/commit/4e909f912aef943bbddc92150b821aeef9d7a20e))
5
+ - **(localUsage):** pin window monotonicity, and stop two tests lying about failure ([f07f145](https://github.com/juspay/neurolink/commit/f07f1454e457f73c3d9b162faa09f1cd624f9e27))
10
6
 
11
7
  ## [11.2.3](https://github.com/juspay/neurolink/compare/v11.2.2...v11.2.3) (2026-08-19)
12
8
 
@@ -33,7 +33,7 @@ export declare function isProviderAvailable(providerName: string): boolean;
33
33
  */
34
34
  export declare function getBestAvailableProvider(preferCheap?: boolean): ProviderModelConfig | null;
35
35
  /**
36
- Record actual provider performance for optimization
36
+ * Record actual provider performance for optimization
37
37
  */
38
38
  export declare function recordProviderPerformanceFromMetrics(providerName: string, metrics: {
39
39
  responseTime: number;
@@ -111,7 +111,7 @@ export function getBestAvailableProvider(preferCheap = true) {
111
111
  return sortedProviders[0];
112
112
  }
113
113
  /**
114
- Record actual provider performance for optimization
114
+ * Record actual provider performance for optimization
115
115
  */
116
116
  export function recordProviderPerformanceFromMetrics(providerName, metrics) {
117
117
  const existing = providerMetrics.get(providerName) || {
@@ -16,14 +16,43 @@
16
16
  * Three fixes in three files each closed one door and left the others open.
17
17
  * The logic lives here once now, so the next door closes everywhere at once.
18
18
  *
19
- * Contract: `Infinity` is the ONLY value meaning all-history. Anything that is
20
- * not a usable finite window NaN, negative, or so large the arithmetic stops
21
- * being finite — collapses to a zero-length window, which is what a
22
- * nonsensical request should read as.
19
+ * Contract, stated as the two directions rather than as one rule, because the
20
+ * single-sentence version of it was wrong here for weeks:
21
+ *
22
+ * - `0`, negatives, `-Infinity` and `NaN` are NOT windows. They collapse to
23
+ * a zero-length one and read nothing. Two of the three historical defects
24
+ * above are here (`0` and `NaN`); `-Infinity` and negatives are the same
25
+ * class and were fixed with them.
26
+ * - `Infinity`, and any finite value whose window is longer than any
27
+ * history, mean ALL HISTORY. The THIRD historical defect — `MAX_VALUE` —
28
+ * lives in this bucket, not the one above: what was wrong about it was the
29
+ * mechanism (a `-Infinity` cutoff), never the outcome. A window of 1e308 days covers every
30
+ * transcript that could exist, so "everything" is the right answer to it
31
+ * and "nothing" is a wrong one.
32
+ *
33
+ * The prose here used to say the opposite of that second point — that a span
34
+ * too large to stay finite "collapses to a zero-length window". The code never
35
+ * did that, and the code was right. Anyone reconciling the two by changing the
36
+ * code re-creates a defect this suite has already seen once: asserting
37
+ * absurd-means-nothing produces a NON-MONOTONIC CLIFF, where 2.07e300 read
38
+ * everything, 2.09e300 read nothing, and `Infinity` read everything again.
39
+ * That was found by running the CLI — `usage local --since 999999999999`
40
+ * reported 518,576 turns while `--since 1e308` reported 39 — not by reading
41
+ * either the code or this comment.
42
+ *
43
+ * The invariant that actually holds, and the one worth testing, is
44
+ * MONOTONICITY: a wider window never reads less than a narrower one, across
45
+ * the whole range including the absurd end.
23
46
  */
24
47
  export declare const DEFAULT_SINCE_DAYS = 30;
25
48
  /**
26
49
  * @returns the epoch-ms cutoff a scan must not read past, or `undefined` for an
27
- * unbounded (all-history) scan — which only `Infinity` produces.
50
+ * unbounded (all-history) scan.
51
+ *
52
+ * `undefined` has TWO sources, not one, and this line used to name only the
53
+ * first: an explicit `Infinity`, and any finite request whose span overflows
54
+ * (`Number.MAX_VALUE`). They mean the same thing on purpose — see the contract
55
+ * above — but a reader who believes only `Infinity` reaches this branch will
56
+ * mis-handle the second.
28
57
  */
29
58
  export declare function resolveScanCutoffMs(sinceDays: number | undefined, defaultDays?: number): number | undefined;
@@ -16,16 +16,45 @@
16
16
  * Three fixes in three files each closed one door and left the others open.
17
17
  * The logic lives here once now, so the next door closes everywhere at once.
18
18
  *
19
- * Contract: `Infinity` is the ONLY value meaning all-history. Anything that is
20
- * not a usable finite window NaN, negative, or so large the arithmetic stops
21
- * being finite — collapses to a zero-length window, which is what a
22
- * nonsensical request should read as.
19
+ * Contract, stated as the two directions rather than as one rule, because the
20
+ * single-sentence version of it was wrong here for weeks:
21
+ *
22
+ * - `0`, negatives, `-Infinity` and `NaN` are NOT windows. They collapse to
23
+ * a zero-length one and read nothing. Two of the three historical defects
24
+ * above are here (`0` and `NaN`); `-Infinity` and negatives are the same
25
+ * class and were fixed with them.
26
+ * - `Infinity`, and any finite value whose window is longer than any
27
+ * history, mean ALL HISTORY. The THIRD historical defect — `MAX_VALUE` —
28
+ * lives in this bucket, not the one above: what was wrong about it was the
29
+ * mechanism (a `-Infinity` cutoff), never the outcome. A window of 1e308 days covers every
30
+ * transcript that could exist, so "everything" is the right answer to it
31
+ * and "nothing" is a wrong one.
32
+ *
33
+ * The prose here used to say the opposite of that second point — that a span
34
+ * too large to stay finite "collapses to a zero-length window". The code never
35
+ * did that, and the code was right. Anyone reconciling the two by changing the
36
+ * code re-creates a defect this suite has already seen once: asserting
37
+ * absurd-means-nothing produces a NON-MONOTONIC CLIFF, where 2.07e300 read
38
+ * everything, 2.09e300 read nothing, and `Infinity` read everything again.
39
+ * That was found by running the CLI — `usage local --since 999999999999`
40
+ * reported 518,576 turns while `--since 1e308` reported 39 — not by reading
41
+ * either the code or this comment.
42
+ *
43
+ * The invariant that actually holds, and the one worth testing, is
44
+ * MONOTONICITY: a wider window never reads less than a narrower one, across
45
+ * the whole range including the absurd end.
23
46
  */
24
47
  export const DEFAULT_SINCE_DAYS = 30;
25
48
  const MS_PER_DAY = 86_400_000;
26
49
  /**
27
50
  * @returns the epoch-ms cutoff a scan must not read past, or `undefined` for an
28
- * unbounded (all-history) scan — which only `Infinity` produces.
51
+ * unbounded (all-history) scan.
52
+ *
53
+ * `undefined` has TWO sources, not one, and this line used to name only the
54
+ * first: an explicit `Infinity`, and any finite request whose span overflows
55
+ * (`Number.MAX_VALUE`). They mean the same thing on purpose — see the contract
56
+ * above — but a reader who believes only `Infinity` reaches this branch will
57
+ * mis-handle the second.
29
58
  */
30
59
  export function resolveScanCutoffMs(sinceDays, defaultDays = DEFAULT_SINCE_DAYS) {
31
60
  const requested = sinceDays ?? defaultDays;
@@ -17,34 +17,37 @@
17
17
  * collapsing into one bucket with every other unknown.
18
18
  */
19
19
  /**
20
- * Deliberately NOT mapped, with the measurement that ruled each one out.
20
+ * Deliberately NOT mapped, and why each was ruled out.
21
21
  *
22
- * Copilot CLI is the one client here that cannot be identified from its
23
- * User-Agent, and both of the strings it sends are actively unsafe to key on:
22
+ * These two strings are unrelated to each other. They are grouped only because
23
+ * both were candidates for a Copilot mapping at some point, and neither can
24
+ * carry one.
24
25
  *
25
- * - `OpenAI/JS 5.20.1` — the stock OpenAI JS SDK UA, sent by every caller of
26
- * that SDK. Mapping it to Copilot would file unrelated OpenAI-SDK traffic
27
- * under Copilot's name, which is worse than leaving it unattributed.
28
- - `Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)` not a
29
- * CLI's User-Agent at all. This is what `curl` sends on a machine whose
30
- * `~/.curlrc` sets `user-agent`, so every curl-driven caller on such a host
31
- * shares it: scripts, agents, health probes. It accounted for the largest
32
- * single block of `unknown` rows in the log this table was measured against,
33
- * which is exactly what made it tempting.
26
+ * - `OpenAI/JS 5.20.1` — Copilot CLI's actual User-Agent, and the problem is
27
+ * that it is not Copilot's alone: it is the stock OpenAI JS SDK string, sent
28
+ * by every caller of that SDK. Mapping it would file unrelated OpenAI-SDK
29
+ * traffic under Copilot's name, which is worse than leaving it unattributed.
30
+ * Copilot also sends `x-initiator` and `x-interaction-type`, but neither is
31
+ * exclusive to it either, so it stays `unknown` and remains traceable
32
+ * through the stored raw header.
34
33
  *
35
- * Recorded because the first pass got this wrong in a way worth naming. The
36
- * string was seen arriving at two capture servers during Copilot CLI and
37
- * Gemini CLI runs and was written up as "sent by both CLIs". It was neither:
38
- * it was the aliveness `curl` fired at each capture server moments before
39
- * the CLI, picking up that host's curlrc. The paths gave it away on review —
40
- * the Gemini-side hit was a bare `GET /v1beta/models`, which is the probe's
41
- * URL and not one the CLI requests. A shared string across two unrelated
42
- * clients should have read as "shared dependency or shared tooling", not as
43
- * a property of either client.
34
+ * - `Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)` not a
35
+ * CLI's User-Agent at all, and in particular NOT Copilot's. It is what
36
+ * `curl` sends on a machine whose `~/.curlrc` sets `user-agent`, so every
37
+ * curl-driven caller on such a host shares it: scripts, agents, health
38
+ * probes. It accounted for the largest single block of `unknown` rows in the
39
+ * log this table was measured against, which is exactly what made it
40
+ * tempting.
44
41
  *
45
- * Copilot does send `x-initiator` and `x-interaction-type`, but neither is
46
- * exclusive to it either. Attributing it needs a signal nobody has found yet,
47
- * so it stays `unknown` and remains traceable through the stored raw header.
42
+ * Recorded because the first pass got this wrong in a way worth naming. The
43
+ * string was seen arriving at two capture servers during a Copilot CLI run
44
+ * and a Gemini CLI run, and was written up as "sent by both CLIs". It was
45
+ * sent by neither: it was the aliveness `curl` fired at each capture server
46
+ * moments before the CLI was pointed at it, picking up that host's curlrc.
47
+ * The request paths gave it away on review — the Gemini-side hit was a bare
48
+ * `GET /v1beta/models`, which is the probe's URL and not one the CLI
49
+ * requests. An identical unusual string arriving from two unrelated clients
50
+ * is evidence of shared tooling, never a property of either client.
48
51
  */
49
52
  /**
50
53
  * The client names this table can produce.
@@ -41,34 +41,37 @@ const CLIENT_PREFIXES = [
41
41
  ["codex_exec/", "codex"],
42
42
  ];
43
43
  /**
44
- * Deliberately NOT mapped, with the measurement that ruled each one out.
44
+ * Deliberately NOT mapped, and why each was ruled out.
45
45
  *
46
- * Copilot CLI is the one client here that cannot be identified from its
47
- * User-Agent, and both of the strings it sends are actively unsafe to key on:
46
+ * These two strings are unrelated to each other. They are grouped only because
47
+ * both were candidates for a Copilot mapping at some point, and neither can
48
+ * carry one.
48
49
  *
49
- * - `OpenAI/JS 5.20.1` — the stock OpenAI JS SDK UA, sent by every caller of
50
- * that SDK. Mapping it to Copilot would file unrelated OpenAI-SDK traffic
51
- * under Copilot's name, which is worse than leaving it unattributed.
52
- - `Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)` not a
53
- * CLI's User-Agent at all. This is what `curl` sends on a machine whose
54
- * `~/.curlrc` sets `user-agent`, so every curl-driven caller on such a host
55
- * shares it: scripts, agents, health probes. It accounted for the largest
56
- * single block of `unknown` rows in the log this table was measured against,
57
- * which is exactly what made it tempting.
50
+ * - `OpenAI/JS 5.20.1` — Copilot CLI's actual User-Agent, and the problem is
51
+ * that it is not Copilot's alone: it is the stock OpenAI JS SDK string, sent
52
+ * by every caller of that SDK. Mapping it would file unrelated OpenAI-SDK
53
+ * traffic under Copilot's name, which is worse than leaving it unattributed.
54
+ * Copilot also sends `x-initiator` and `x-interaction-type`, but neither is
55
+ * exclusive to it either, so it stays `unknown` and remains traceable
56
+ * through the stored raw header.
58
57
  *
59
- * Recorded because the first pass got this wrong in a way worth naming. The
60
- * string was seen arriving at two capture servers during Copilot CLI and
61
- * Gemini CLI runs and was written up as "sent by both CLIs". It was neither:
62
- * it was the aliveness `curl` fired at each capture server moments before
63
- * the CLI, picking up that host's curlrc. The paths gave it away on review —
64
- * the Gemini-side hit was a bare `GET /v1beta/models`, which is the probe's
65
- * URL and not one the CLI requests. A shared string across two unrelated
66
- * clients should have read as "shared dependency or shared tooling", not as
67
- * a property of either client.
58
+ * - `Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)` not a
59
+ * CLI's User-Agent at all, and in particular NOT Copilot's. It is what
60
+ * `curl` sends on a machine whose `~/.curlrc` sets `user-agent`, so every
61
+ * curl-driven caller on such a host shares it: scripts, agents, health
62
+ * probes. It accounted for the largest single block of `unknown` rows in the
63
+ * log this table was measured against, which is exactly what made it
64
+ * tempting.
68
65
  *
69
- * Copilot does send `x-initiator` and `x-interaction-type`, but neither is
70
- * exclusive to it either. Attributing it needs a signal nobody has found yet,
71
- * so it stays `unknown` and remains traceable through the stored raw header.
66
+ * Recorded because the first pass got this wrong in a way worth naming. The
67
+ * string was seen arriving at two capture servers during a Copilot CLI run
68
+ * and a Gemini CLI run, and was written up as "sent by both CLIs". It was
69
+ * sent by neither: it was the aliveness `curl` fired at each capture server
70
+ * moments before the CLI was pointed at it, picking up that host's curlrc.
71
+ * The request paths gave it away on review — the Gemini-side hit was a bare
72
+ * `GET /v1beta/models`, which is the probe's URL and not one the CLI
73
+ * requests. An identical unusual string arriving from two unrelated clients
74
+ * is evidence of shared tooling, never a property of either client.
72
75
  */
73
76
  /**
74
77
  * The client names this table can produce.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.7.0",
3
+ "version": "12.7.2",
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": {