@juspay/neurolink 12.18.1 → 12.19.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +278 -76
  3. package/dist/browser/neurolink.min.js +396 -396
  4. package/dist/cli/commands/setup.js +2 -1
  5. package/dist/cli/factories/commandFactory.d.ts +22 -2
  6. package/dist/cli/factories/commandFactory.js +14 -2
  7. package/dist/cli/loop/optionsSchema.js +4 -0
  8. package/dist/cli/utils/classifierRouterFlags.js +39 -1
  9. package/dist/constants/enums.d.ts +13 -0
  10. package/dist/constants/enums.js +14 -0
  11. package/dist/context/budgetChecker.d.ts +3 -1
  12. package/dist/context/budgetChecker.js +20 -4
  13. package/dist/context/contextCompactor.d.ts +43 -3
  14. package/dist/context/contextCompactor.js +157 -41
  15. package/dist/context/contextDecision.d.ts +56 -0
  16. package/dist/context/contextDecision.js +234 -0
  17. package/dist/core/baseProvider.d.ts +27 -1
  18. package/dist/core/baseProvider.js +39 -0
  19. package/dist/core/toolRouting.d.ts +8 -0
  20. package/dist/core/toolRouting.js +52 -1
  21. package/dist/core/toolRoutingDecision.d.ts +35 -0
  22. package/dist/core/toolRoutingDecision.js +194 -0
  23. package/dist/factories/providerDescriptors.d.ts +15 -0
  24. package/dist/factories/providerDescriptors.js +57 -1
  25. package/dist/factories/providerRegistry.js +9 -1
  26. package/dist/index.d.ts +57 -1
  27. package/dist/index.js +60 -1
  28. package/dist/models/manifestRegistry.js +2 -0
  29. package/dist/models/manifests/typesafe.d.ts +16 -0
  30. package/dist/models/manifests/typesafe.js +42 -0
  31. package/dist/neurolink.d.ts +57 -1
  32. package/dist/neurolink.js +254 -10
  33. package/dist/observability/exporters/laminarExporter.js +3 -0
  34. package/dist/observability/exporters/posthogExporter.js +3 -0
  35. package/dist/observability/utils/spanSerializer.js +4 -0
  36. package/dist/providers/catalog/schema.d.ts +1 -1
  37. package/dist/providers/typesafe.d.ts +112 -0
  38. package/dist/providers/typesafe.js +654 -0
  39. package/dist/proxy/codexFallback.d.ts +18 -0
  40. package/dist/proxy/codexFallback.js +44 -0
  41. package/dist/rag/pipeline/RAGPipeline.d.ts +3 -1
  42. package/dist/rag/pipeline/RAGPipeline.js +65 -4
  43. package/dist/rag/retrieval/searchDecision.d.ts +27 -0
  44. package/dist/rag/retrieval/searchDecision.js +124 -0
  45. package/dist/routing/classifierRouter.d.ts +74 -2
  46. package/dist/routing/classifierRouter.js +232 -32
  47. package/dist/routing/classifierStrategies.d.ts +33 -1
  48. package/dist/routing/classifierStrategies.js +237 -0
  49. package/dist/routing/index.d.ts +1 -1
  50. package/dist/routing/index.js +1 -1
  51. package/dist/routing/modelCatalog.d.ts +79 -0
  52. package/dist/routing/modelCatalog.js +382 -0
  53. package/dist/telemetry/tracers.d.ts +1 -0
  54. package/dist/telemetry/tracers.js +1 -0
  55. package/dist/types/classifierRouter.d.ts +160 -4
  56. package/dist/types/cli.d.ts +17 -1
  57. package/dist/types/codex.d.ts +2 -0
  58. package/dist/types/config.d.ts +12 -0
  59. package/dist/types/context.d.ts +55 -1
  60. package/dist/types/decision.d.ts +200 -0
  61. package/dist/types/decision.js +21 -0
  62. package/dist/types/generate.d.ts +20 -0
  63. package/dist/types/index.d.ts +1 -0
  64. package/dist/types/index.js +2 -0
  65. package/dist/types/providers.d.ts +59 -1
  66. package/dist/types/providers.js +5 -0
  67. package/dist/types/rag.d.ts +48 -0
  68. package/dist/types/span.d.ts +11 -0
  69. package/dist/types/span.js +11 -0
  70. package/dist/types/stream.d.ts +13 -0
  71. package/dist/types/toolRouting.d.ts +56 -0
  72. package/dist/utils/decisionAnswers.d.ts +56 -0
  73. package/dist/utils/decisionAnswers.js +95 -0
  74. package/dist/utils/modelChoices.js +13 -1
  75. package/dist/utils/pricing.js +11 -0
  76. package/dist/utils/providerConfig.d.ts +4 -0
  77. package/dist/utils/providerConfig.js +17 -0
  78. package/docs-site/static/search-index.json +1 -1
  79. package/package.json +16 -3
@@ -14,3 +14,18 @@ export declare const PROVIDER_DESCRIPTORS_BY_NAME: ReadonlyMap<AIProviderName, P
14
14
  * ProviderFactory.normalizeProviderName().
15
15
  */
16
16
  export declare const PROVIDER_ALIAS_INDEX: ReadonlyMap<string, AIProviderName>;
17
+ /**
18
+ * Providers that serve the `decide` inference type, derived from each
19
+ * descriptor's `inferenceKinds`. A provider that declares nothing is a text
20
+ * provider, so it is not here.
21
+ */
22
+ export declare const DECISION_PROVIDERS: readonly ProviderDescriptor[];
23
+ /**
24
+ * The decision provider to use when a caller names none: the first one whose
25
+ * primary credential env var is actually set.
26
+ *
27
+ * This is where "if somebody sets the key, we start using it" is implemented.
28
+ * Returns undefined when none is configured, which every internal consumer
29
+ * treats as "carry on exactly as before".
30
+ */
31
+ export declare function resolveDefaultDecisionProvider(): string | undefined;
@@ -1,7 +1,8 @@
1
1
  import { AIProviderName } from "../constants/enums.js";
2
- import { GoogleAIModels, OpenAIModels, AnthropicModels, VertexModels, MistralModels, OllamaModels, LiteLLMModels, HuggingFaceModels, DeepSeekModels, NvidiaNimModels, OpenRouterModels, CohereModels, VoyageModels, JinaModels, StabilityModels, IdeogramModels, RecraftModels, ReplicateModels, } from "../constants/enums.js";
2
+ import { GoogleAIModels, OpenAIModels, AnthropicModels, VertexModels, MistralModels, OllamaModels, LiteLLMModels, HuggingFaceModels, DeepSeekModels, NvidiaNimModels, OpenRouterModels, CohereModels, VoyageModels, TypeSafeModels, JinaModels, StabilityModels, IdeogramModels, RecraftModels, ReplicateModels, } from "../constants/enums.js";
3
3
  import { API_KEY_FORMATS } from "../utils/providerConfig.js";
4
4
  import { getCatalogJsonEntries, catalogCredentialsKey, catalogEnvVar, } from "../providers/catalog/loader.js";
5
+ import { DEFAULT_INFERENCE_KINDS } from "../types/index.js";
5
6
  /**
6
7
  * Hand-maintained provider identity, credentials, defaults, and runtime
7
8
  * behavior classification for every provider EXCEPT the 8 JSON-catalog
@@ -462,6 +463,37 @@ const HAND_DESCRIPTORS = [
462
463
  healthCheck: "env-only",
463
464
  setupUrl: "https://www.recraft.ai/api",
464
465
  },
466
+ {
467
+ name: AIProviderName.TYPESAFE,
468
+ aliases: ["jev", "typesafe-ai"],
469
+ credentialsKey: "typesafe",
470
+ envVars: {
471
+ apiKey: "TYPESAFE_API_KEY",
472
+ // A Vercel AI Gateway key reaches the same model through a different
473
+ // transport, so it satisfies this provider on its own. Listing it here
474
+ // is what makes `resolveDefaultDecisionProvider()` — and therefore
475
+ // "if somebody sets the key, we start using it" — true for gateway
476
+ // users who never hold a TypeSafe key at all.
477
+ fallbacks: ["AI_GATEWAY_API_KEY"],
478
+ baseURL: "TYPESAFE_BASE_URL",
479
+ model: "TYPESAFE_MODEL",
480
+ },
481
+ defaultModel: TypeSafeModels.JEV_LATEST,
482
+ // Jev serves only the `decide` inference type. Declaring that here is
483
+ // what keeps it out of every generation code path, rather than each of
484
+ // those having to special-case the provider name.
485
+ inferenceKinds: ["decide"],
486
+ // It emits no text, so it cannot call tools and cannot answer a
487
+ // "live-generate" health probe.
488
+ toolSupport: "none",
489
+ localRuntime: false,
490
+ healthCheck: "env-only",
491
+ // Deliberately NO autoSelectPriority / autoSelectPreference /
492
+ // defaultHealthSweepPriority: all three feed generation fallback chains,
493
+ // and a text-less provider must never be reachable from them.
494
+ timeouts: { decideMs: 5000 },
495
+ setupUrl: "https://console.typesafe.ai/keys",
496
+ },
465
497
  ];
466
498
  /**
467
499
  * Builds ProviderDescriptor entries for 8 of the 9 JSON-catalog providers —
@@ -546,3 +578,27 @@ export const PROVIDER_ALIAS_INDEX = new Map(PROVIDER_DESCRIPTORS.flatMap((d) =>
546
578
  [d.name.toLowerCase(), d.name],
547
579
  ...d.aliases.map((alias) => [alias.toLowerCase(), d.name]),
548
580
  ]));
581
+ /**
582
+ * Providers that serve the `decide` inference type, derived from each
583
+ * descriptor's `inferenceKinds`. A provider that declares nothing is a text
584
+ * provider, so it is not here.
585
+ */
586
+ export const DECISION_PROVIDERS = PROVIDER_DESCRIPTORS.filter((d) => (d.inferenceKinds ?? DEFAULT_INFERENCE_KINDS).includes("decide"));
587
+ /**
588
+ * The decision provider to use when a caller names none: the first one whose
589
+ * primary credential env var is actually set.
590
+ *
591
+ * This is where "if somebody sets the key, we start using it" is implemented.
592
+ * Returns undefined when none is configured, which every internal consumer
593
+ * treats as "carry on exactly as before".
594
+ */
595
+ export function resolveDefaultDecisionProvider() {
596
+ for (const descriptor of DECISION_PROVIDERS) {
597
+ const primary = descriptor.envVars.apiKey;
598
+ const candidates = [primary, ...(descriptor.envVars.fallbacks ?? [])];
599
+ if (candidates.some((v) => v && (process.env[v] ?? "").trim() !== "")) {
600
+ return descriptor.name;
601
+ }
602
+ }
603
+ return undefined;
604
+ }
@@ -1,6 +1,6 @@
1
1
  import { ProviderFactory } from "./providerFactory.js";
2
2
  import { logger } from "../utils/logger.js";
3
- import { AIProviderName, GoogleAIModels, OpenAIModels, AnthropicModels, VertexModels, OllamaModels, LiteLLMModels, HuggingFaceModels, DeepSeekModels, NvidiaNimModels, OpenRouterModels, CohereModels, VoyageModels, JinaModels, StabilityModels, IdeogramModels, RecraftModels, ReplicateModels, } from "../constants/enums.js";
3
+ import { AIProviderName, GoogleAIModels, OpenAIModels, AnthropicModels, VertexModels, OllamaModels, LiteLLMModels, HuggingFaceModels, DeepSeekModels, NvidiaNimModels, OpenRouterModels, CohereModels, VoyageModels, JinaModels, StabilityModels, IdeogramModels, RecraftModels, TypeSafeModels, ReplicateModels, } from "../constants/enums.js";
4
4
  import { PROVIDER_DESCRIPTORS_BY_NAME } from "./providerDescriptors.js";
5
5
  import { OPENAI_COMPAT_CATALOG } from "../providers/openaiCompatCatalog.js";
6
6
  import { providerChoicesFor } from "./mediaHandlerCatalog.js";
@@ -233,6 +233,14 @@ export class ProviderRegistry {
233
233
  const { RecraftProvider } = await import("../providers/recraft.js");
234
234
  return new RecraftProvider(modelName, sdk, undefined, recraftCreds);
235
235
  }, process.env.RECRAFT_MODEL || RecraftModels.RECRAFT_V3, ["recraft"], PROVIDER_DESCRIPTORS_BY_NAME.get(AIProviderName.RECRAFT));
236
+ // Register TypeSafe (Jev) — the `decide` inference type, not text.
237
+ // Its descriptor declares inferenceKinds: ["decide"], so nothing in the
238
+ // generation fallback chain can reach it.
239
+ ProviderFactory.registerProvider(AIProviderName.TYPESAFE, async (modelName, _providerName, sdk, _region, credentials) => {
240
+ const typesafeCreds = credentials;
241
+ const { TypeSafeProvider } = await import("../providers/typesafe.js");
242
+ return new TypeSafeProvider(modelName, sdk, undefined, typesafeCreds);
243
+ }, process.env.TYPESAFE_MODEL || TypeSafeModels.JEV_LATEST, ["jev", "typesafe-ai"], PROVIDER_DESCRIPTORS_BY_NAME.get(AIProviderName.TYPESAFE));
236
244
  logger.debug("All AI providers registered successfully");
237
245
  // ===== MEDIA HANDLER REGISTRATION =====
238
246
  // Single registration path (Task 11): each ecosystem barrel (voice,
package/dist/index.d.ts CHANGED
@@ -381,7 +381,63 @@ export { createMultiJudgeWorkflow, MULTI_JUDGE_3_WORKFLOW, MULTI_JUDGE_5_WORKFLO
381
381
  * });
382
382
  * ```
383
383
  */
384
- export { classifyProviderError, ModelPool, createDefaultRequestRouter, ClassifierRouter, classifyHeuristic, } from "./routing/index.js";
384
+ export { classifyProviderError, ModelPool, createDefaultRequestRouter, ClassifierRouter, classifyHeuristic, classifyJev, } from "./routing/index.js";
385
+ /**
386
+ * The `decide` inference type — typed, calibrated judgements from a model that
387
+ * generates no text, alongside `generate` and `stream`.
388
+ *
389
+ * Call it with `neurolink.decide({ state, questions })`, or `tryDecide()` for
390
+ * the fail-open variant every internal consumer uses. TypeSafe's Jev is the
391
+ * first provider; a provider declares the capability with `"decide"` in its
392
+ * descriptor's `inferenceKinds`.
393
+ *
394
+ * Latency on a decision model is flat in question count — 1 question ~393ms,
395
+ * 400 questions ~465ms — while concurrent requests queue. Always batch; never
396
+ * fan out. A `choice` answer carries the full distribution, so one question
397
+ * over N options also ranks all N.
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * import { NeuroLink, readDecisionChoice } from '@juspay/neurolink';
402
+ *
403
+ * const result = await new NeuroLink().tryDecide({ // null if unconfigured
404
+ * state: ticketText,
405
+ * questions: {
406
+ * team: {
407
+ * type: 'choice',
408
+ * instructions: 'Which team should handle this?',
409
+ * criteria: { billing: 'Payments', technical: 'Bugs', sales: 'Pricing' },
410
+ * },
411
+ * urgent: { type: 'boolean', instructions: 'Is this urgent?' },
412
+ * },
413
+ * });
414
+ * const team = result && readDecisionChoice(result.answers, 'team');
415
+ * if (team && team.confidence > 0.7) { route(team.choice); }
416
+ * ```
417
+ */
418
+ export { decisionBooleanConfidence, decisionKey, gateDecisionBoolean, readDecisionBoolean, readDecisionChoice, readDecisionScore, servesInferenceKind, } from "./utils/decisionAnswers.js";
419
+ export { DECISION_PROVIDERS, resolveDefaultDecisionProvider, } from "./factories/providerDescriptors.js";
420
+ export { TYPESAFE_MAX_REQUEST_TOKENS, TYPESAFE_MAX_STATE_TOKENS, } from "./providers/typesafe.js";
421
+ /**
422
+ * The decision consumers.
423
+ *
424
+ * Each takes an injected fail-open `decide` caller — a bound
425
+ * `NeuroLink.tryDecide` — and returns `null` when nothing should change, so a
426
+ * host that wires one into its own pipeline inherits the same degradation
427
+ * contract NeuroLink uses internally: no decision provider configured means
428
+ * the behaviour is exactly what it was before.
429
+ *
430
+ * They are exported because each is independently useful. A host routing its
431
+ * own tool set, compacting its own transcript, or planning its own retrieval
432
+ * should not have to reimplement the question wording, the calibration gates
433
+ * or the asymmetric thresholds that make these work.
434
+ */
435
+ export { CLASSIFIER_CONTEXT_SCOPES, CLASSIFIER_DIFFICULTIES, contextScopeToThreshold, } from "./routing/classifierStrategies.js";
436
+ export { buildModelCatalog, buildRegistryIndex, enrichCandidate, rankCatalogue, reachableTextProviders, renderCandidate, } from "./routing/modelCatalog.js";
437
+ export { selectServersByDecision } from "./core/toolRoutingDecision.js";
438
+ export { selectIrrelevantMessages, summaryPreservesContext, } from "./context/contextDecision.js";
439
+ export { decideSearchPlan } from "./rag/retrieval/searchDecision.js";
440
+ export { DEFAULT_COMPACTION_THRESHOLD, resolveHistoryBudget, } from "./context/budgetChecker.js";
385
441
  /**
386
442
  * Server Adapters for exposing NeuroLink as HTTP APIs
387
443
  *
package/dist/index.js CHANGED
@@ -610,7 +610,66 @@ export { createMultiJudgeWorkflow, MULTI_JUDGE_3_WORKFLOW, MULTI_JUDGE_5_WORKFLO
610
610
  * });
611
611
  * ```
612
612
  */
613
- export { classifyProviderError, ModelPool, createDefaultRequestRouter, ClassifierRouter, classifyHeuristic, } from "./routing/index.js";
613
+ export { classifyProviderError, ModelPool, createDefaultRequestRouter, ClassifierRouter, classifyHeuristic, classifyJev, } from "./routing/index.js";
614
+ // ============================================================================
615
+ // Decision inference type (`decide`)
616
+ // ============================================================================
617
+ /**
618
+ * The `decide` inference type — typed, calibrated judgements from a model that
619
+ * generates no text, alongside `generate` and `stream`.
620
+ *
621
+ * Call it with `neurolink.decide({ state, questions })`, or `tryDecide()` for
622
+ * the fail-open variant every internal consumer uses. TypeSafe's Jev is the
623
+ * first provider; a provider declares the capability with `"decide"` in its
624
+ * descriptor's `inferenceKinds`.
625
+ *
626
+ * Latency on a decision model is flat in question count — 1 question ~393ms,
627
+ * 400 questions ~465ms — while concurrent requests queue. Always batch; never
628
+ * fan out. A `choice` answer carries the full distribution, so one question
629
+ * over N options also ranks all N.
630
+ *
631
+ * @example
632
+ * ```ts
633
+ * import { NeuroLink, readDecisionChoice } from '@juspay/neurolink';
634
+ *
635
+ * const result = await new NeuroLink().tryDecide({ // null if unconfigured
636
+ * state: ticketText,
637
+ * questions: {
638
+ * team: {
639
+ * type: 'choice',
640
+ * instructions: 'Which team should handle this?',
641
+ * criteria: { billing: 'Payments', technical: 'Bugs', sales: 'Pricing' },
642
+ * },
643
+ * urgent: { type: 'boolean', instructions: 'Is this urgent?' },
644
+ * },
645
+ * });
646
+ * const team = result && readDecisionChoice(result.answers, 'team');
647
+ * if (team && team.confidence > 0.7) { route(team.choice); }
648
+ * ```
649
+ */
650
+ export { decisionBooleanConfidence, decisionKey, gateDecisionBoolean, readDecisionBoolean, readDecisionChoice, readDecisionScore, servesInferenceKind, } from "./utils/decisionAnswers.js";
651
+ export { DECISION_PROVIDERS, resolveDefaultDecisionProvider, } from "./factories/providerDescriptors.js";
652
+ export { TYPESAFE_MAX_REQUEST_TOKENS, TYPESAFE_MAX_STATE_TOKENS, } from "./providers/typesafe.js";
653
+ /**
654
+ * The decision consumers.
655
+ *
656
+ * Each takes an injected fail-open `decide` caller — a bound
657
+ * `NeuroLink.tryDecide` — and returns `null` when nothing should change, so a
658
+ * host that wires one into its own pipeline inherits the same degradation
659
+ * contract NeuroLink uses internally: no decision provider configured means
660
+ * the behaviour is exactly what it was before.
661
+ *
662
+ * They are exported because each is independently useful. A host routing its
663
+ * own tool set, compacting its own transcript, or planning its own retrieval
664
+ * should not have to reimplement the question wording, the calibration gates
665
+ * or the asymmetric thresholds that make these work.
666
+ */
667
+ export { CLASSIFIER_CONTEXT_SCOPES, CLASSIFIER_DIFFICULTIES, contextScopeToThreshold, } from "./routing/classifierStrategies.js";
668
+ export { buildModelCatalog, buildRegistryIndex, enrichCandidate, rankCatalogue, reachableTextProviders, renderCandidate, } from "./routing/modelCatalog.js";
669
+ export { selectServersByDecision } from "./core/toolRoutingDecision.js";
670
+ export { selectIrrelevantMessages, summaryPreservesContext, } from "./context/contextDecision.js";
671
+ export { decideSearchPlan } from "./rag/retrieval/searchDecision.js";
672
+ export { DEFAULT_COMPACTION_THRESHOLD, resolveHistoryBudget, } from "./context/budgetChecker.js";
614
673
  // ============================================================================
615
674
  // SERVER ADAPTERS - HTTP API Framework Integration
616
675
  // ============================================================================
@@ -19,6 +19,7 @@ import { lmStudioManifest } from "./manifests/lm-studio.js";
19
19
  import { llamacppManifest } from "./manifests/llamacpp.js";
20
20
  import { xaiManifest } from "./manifests/xai.js";
21
21
  import { groqManifest } from "./manifests/groq.js";
22
+ import { typesafeManifest } from "./manifests/typesafe.js";
22
23
  import { cohereManifest } from "./manifests/cohere.js";
23
24
  import { togetherAiManifest } from "./manifests/together-ai.js";
24
25
  import { fireworksManifest } from "./manifests/fireworks.js";
@@ -107,6 +108,7 @@ export const MANIFEST_REGISTRY = {
107
108
  llamacpp: llamacppManifest,
108
109
  xai: xaiManifest,
109
110
  groq: groqManifest,
111
+ typesafe: typesafeManifest,
110
112
  cerebras: catalogManifest("cerebras"),
111
113
  sambanova: catalogManifest("sambanova"),
112
114
  cohere: cohereManifest,
@@ -0,0 +1,16 @@
1
+ import type { ProviderModelManifest } from "../../types/index.js";
2
+ /**
3
+ * TypeSafe (Jev) — the `decide` inference type, not text generation.
4
+ *
5
+ * `contextWindow` is genuinely meaningful here: it is the budget for the
6
+ * `state` being judged, measured by bisection at ~33,000 tokens for state
7
+ * plus the longest single question. (A separate, larger ~64,000 ceiling
8
+ * governs state plus ALL questions; the manifest has nowhere to express a
9
+ * second limit, and the tighter one is the safe number to publish.)
10
+ *
11
+ * `maxOutputTokens` is required by the manifest type but has no honest value
12
+ * for a model that emits no text — Jev returns a handful of numbers per
13
+ * question, so a small non-zero figure is the least misleading choice.
14
+ * `functionCalling` and `vision` are false: it has neither.
15
+ */
16
+ export declare const typesafeManifest: ProviderModelManifest;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * TypeSafe (Jev) — the `decide` inference type, not text generation.
3
+ *
4
+ * `contextWindow` is genuinely meaningful here: it is the budget for the
5
+ * `state` being judged, measured by bisection at ~33,000 tokens for state
6
+ * plus the longest single question. (A separate, larger ~64,000 ceiling
7
+ * governs state plus ALL questions; the manifest has nowhere to express a
8
+ * second limit, and the tighter one is the safe number to publish.)
9
+ *
10
+ * `maxOutputTokens` is required by the manifest type but has no honest value
11
+ * for a model that emits no text — Jev returns a handful of numbers per
12
+ * question, so a small non-zero figure is the least misleading choice.
13
+ * `functionCalling` and `vision` are false: it has neither.
14
+ */
15
+ export const typesafeManifest = {
16
+ defaultContextWindow: 33000,
17
+ models: {
18
+ _default: {
19
+ aliases: ["jev"],
20
+ contextWindow: 33000,
21
+ maxOutputTokens: 1024,
22
+ vision: false,
23
+ functionCalling: false,
24
+ },
25
+ "jev-latest": {
26
+ aliases: ["jev"],
27
+ displayName: "Jev (latest)",
28
+ contextWindow: 33000,
29
+ maxOutputTokens: 1024,
30
+ vision: false,
31
+ functionCalling: false,
32
+ },
33
+ "jev-preview": {
34
+ aliases: [],
35
+ displayName: "Jev (preview)",
36
+ contextWindow: 33000,
37
+ maxOutputTokens: 1024,
38
+ vision: false,
39
+ functionCalling: false,
40
+ },
41
+ },
42
+ };
@@ -5,7 +5,7 @@
5
5
  * Enhanced AI provider system with natural MCP tool access.
6
6
  * Uses real MCP infrastructure for tool discovery and execution.
7
7
  */
8
- import type { AgentDefinition, AgentNetworkConfig, AgentRunOptions, AgentRunOutcome, AgentToolRegistrationOptions, IsolatedAgentDefinition, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk, WorkerInstanceOptions } from "./types/index.js";
8
+ import type { DecisionOptions, DecisionResult, AgentDefinition, AgentNetworkConfig, AgentRunOptions, AgentRunOutcome, AgentToolRegistrationOptions, IsolatedAgentDefinition, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk, WorkerInstanceOptions } from "./types/index.js";
9
9
  import type { CompactionConfig, CompactionResult, ArtifactStore, SpanData, ObservabilityConfig, MetricsSummary, MCPToolAnnotations, TraceView, AuthenticatedContext, AuthProvider, JsonObject, NeuroLinkEvents, TypedEventEmitter, MCPEnhancementsConfig, NeuroLinkAuthConfig, NeurolinkConstructorConfig, ChatMessage, ExternalMCPOperationResult, ExternalMCPServerInstance, ExternalMCPToolInfo, GenerateOptions, GenerateResult, ProviderStatus, TextGenerationOptions, TextGenerationResult, MCPExecutableTool, MCPServerInfo, MCPStatus, StreamOptions, StreamResult, ToolExecutionContext, ToolExecutionSummary, ToolInfo, ToolRegistrationOptions, BatchOperationResult, StreamGenerationEndContext, ToolRoutingServerDescriptor, ToolDedupConfig, ToolConfig, KnowledgeEngineStatus, ChecklistState, ArtifactPageRequest, BankArtifactOptions, BankedArtifactRef, DelegateCollectRequest, DelegateCollectResult, DelegateHandle, DelegateRegistrationOptions, DelegateSpawnOptions, BackgroundCommandHandle, BackgroundCommandOptions, BackgroundCommandOutputPage, BackgroundCommandPageRequest, BackgroundCommandPolicy, BackgroundCommandStatus, GitToolResult, GitToolsetOptions } from "./types/index.js";
10
10
  import { ConversationMemoryManager } from "./core/conversationMemoryManager.js";
11
11
  import type { RedisConversationMemoryManager } from "./core/redisConversationMemoryManager.js";
@@ -149,6 +149,7 @@ export declare class NeuroLink {
149
149
  private readonly modelPool;
150
150
  private readonly requestRouter;
151
151
  private readonly classifierRouter;
152
+ private readonly contextRelevanceOptions;
152
153
  /**
153
154
  * Merge instance-level credentials with per-call credentials.
154
155
  *
@@ -813,6 +814,14 @@ export declare class NeuroLink {
813
814
  * @param thinkingLevel — optional thinking level string from the call options.
814
815
  */
815
816
  private applyRequestRouter;
817
+ /**
818
+ * Dependencies handed to every `ContextCompactor`.
819
+ *
820
+ * `tryDecide` returns null whenever no decision provider is configured or
821
+ * the call fails, so passing this unconditionally is safe: the compactor
822
+ * runs its previous pipeline unchanged and pays nothing for the option.
823
+ */
824
+ private contextCompactorDeps;
816
825
  /**
817
826
  * Applies the host-configured `classifierRouter` to `options` in place.
818
827
  *
@@ -2318,6 +2327,53 @@ export declare class NeuroLink {
2318
2327
  * ```
2319
2328
  */
2320
2329
  createEvaluationPipeline(configOrPreset: import("./types/index.js").PipelineConfig | "safety" | "rag" | "quality" | "comprehensive" | "minimal" | "summarization" | "customerSupport" | "codeGeneration"): Promise<import("./evaluation/pipeline/evaluationPipeline.js").EvaluationPipeline>;
2330
+ /**
2331
+ * Run the `decide` inference type: evaluate a `state` against a batch of
2332
+ * named, typed questions and get one typed answer each.
2333
+ *
2334
+ * This is NOT {@link NeuroLink.evaluate}, which scores an already-generated
2335
+ * response with RAGAS scorers. `decide` calls a decision model — one that
2336
+ * emits no text at all and returns calibrated, typed judgements your code
2337
+ * can branch on.
2338
+ *
2339
+ * **Batch, never fan out.** On a decision model, latency is flat in
2340
+ * question count (measured: 1 question 393ms, 400 questions 465ms) while
2341
+ * concurrent requests queue. Put every question you might need into one
2342
+ * call — speculative questions are nearly free, a second round trip is not.
2343
+ *
2344
+ * A `choice` answer carries the full probability distribution, so one
2345
+ * question over N options also ranks all N.
2346
+ *
2347
+ * @example
2348
+ * ```typescript
2349
+ * const result = await neurolink.decide({
2350
+ * state: ticketText,
2351
+ * questions: {
2352
+ * team: {
2353
+ * type: "choice",
2354
+ * instructions: "Which team should handle this?",
2355
+ * criteria: { billing: "Payments", technical: "Bugs", sales: "Pricing" },
2356
+ * },
2357
+ * urgent: { type: "boolean", instructions: "Is this urgent?" },
2358
+ * },
2359
+ * });
2360
+ * const team = readDecisionChoice(result.answers, "team");
2361
+ * if (team && team.confidence > 0.7) { assign(team.choice); }
2362
+ * ```
2363
+ *
2364
+ * @throws when no decision provider is configured, or the call fails
2365
+ */
2366
+ decide(options: DecisionOptions): Promise<DecisionResult>;
2367
+ /**
2368
+ * Fail-open {@link NeuroLink.decide}: returns null on any failure instead
2369
+ * of throwing.
2370
+ *
2371
+ * This is the contract every internal consumer relies on. A decision model
2372
+ * that is unconfigured, slow, rate-limited or down must never change
2373
+ * NeuroLink's observable behaviour — the caller falls back to whatever it
2374
+ * did before the decision was available.
2375
+ */
2376
+ tryDecide(options: DecisionOptions): Promise<DecisionResult | null>;
2321
2377
  /**
2322
2378
  * Evaluate an AI response using the specified pipeline or scorers.
2323
2379
  * This is a convenience method that creates a pipeline and executes it in one call.