@juspay/neurolink 12.47.14 → 12.48.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 (94) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist/auth/middleware/AuthMiddleware.d.ts +1 -1
  3. package/dist/browser/neurolink.min.js +578 -565
  4. package/dist/cli/factories/commandFactory.d.ts +7 -0
  5. package/dist/cli/factories/commandFactory.js +26 -0
  6. package/dist/cli/loop/optionsSchema.js +9 -0
  7. package/dist/context/budgetChecker.js +54 -2
  8. package/dist/context/contextDecision.js +2 -0
  9. package/dist/context/toolPairRepair.d.ts +12 -0
  10. package/dist/context/toolPairRepair.js +29 -3
  11. package/dist/core/baseProvider.d.ts +92 -3
  12. package/dist/core/baseProvider.js +254 -10
  13. package/dist/core/conversationMemoryManager.js +17 -2
  14. package/dist/core/loopEngine.js +1 -1
  15. package/dist/core/modules/MessageBuilder.js +11 -3
  16. package/dist/core/modules/TelemetryHandler.d.ts +2 -2
  17. package/dist/core/modules/ToolsManager.d.ts +35 -0
  18. package/dist/core/modules/ToolsManager.js +159 -55
  19. package/dist/core/nativeGenerateLoop.d.ts +58 -1
  20. package/dist/core/nativeGenerateLoop.js +277 -3
  21. package/dist/core/redisConversationMemoryManager.js +10 -3
  22. package/dist/core/resolveRequestKind.d.ts +24 -4
  23. package/dist/core/resolveRequestKind.js +31 -4
  24. package/dist/core/toolExecutionRecorder.d.ts +6 -0
  25. package/dist/core/toolExecutionRecorder.js +24 -2
  26. package/dist/core/toolRoutingDecision.js +1 -0
  27. package/dist/factories/mediaHandlerCatalog.js +5 -0
  28. package/dist/factories/providerDescriptors.js +15 -0
  29. package/dist/files/fileTools.d.ts +1 -1
  30. package/dist/index.d.ts +5 -2
  31. package/dist/index.js +9 -2
  32. package/dist/memory/condensationPrompt.d.ts +8 -0
  33. package/dist/memory/condensationPrompt.js +29 -0
  34. package/dist/memory/hippocampusInitializer.d.ts +14 -2
  35. package/dist/memory/hippocampusInitializer.js +64 -3
  36. package/dist/neurolink.d.ts +252 -3
  37. package/dist/neurolink.js +898 -43
  38. package/dist/providers/amazonBedrock/client.js +6 -0
  39. package/dist/providers/amazonSagemaker.js +14 -1
  40. package/dist/providers/anthropic/client.js +148 -19
  41. package/dist/providers/anthropic/loopAdapter.js +2 -2
  42. package/dist/providers/googleAiStudio/client.js +2 -1
  43. package/dist/providers/openaiChatCompletionsBase.js +103 -23
  44. package/dist/providers/systemOneDecision.d.ts +6 -0
  45. package/dist/providers/systemOneDecision.js +14 -63
  46. package/dist/providers/typesafe.d.ts +6 -0
  47. package/dist/providers/typesafe.js +6 -0
  48. package/dist/rag/retrieval/searchDecision.js +1 -0
  49. package/dist/routing/classifierRouter.js +6 -5
  50. package/dist/routing/classifierStrategies.js +8 -1
  51. package/dist/types/classifierRouter.d.ts +16 -3
  52. package/dist/types/common.d.ts +2 -0
  53. package/dist/types/config.d.ts +9 -0
  54. package/dist/types/context.d.ts +8 -1
  55. package/dist/types/conversation.d.ts +87 -0
  56. package/dist/types/decision.d.ts +210 -1
  57. package/dist/types/decision.js +9 -1
  58. package/dist/types/dispatch.d.ts +11 -4
  59. package/dist/types/generate.d.ts +118 -54
  60. package/dist/types/loopEngine.d.ts +7 -2
  61. package/dist/types/memory.d.ts +177 -9
  62. package/dist/types/openaiCompatible.d.ts +11 -3
  63. package/dist/types/stream.d.ts +13 -16
  64. package/dist/types/stt.d.ts +58 -1
  65. package/dist/types/tools.d.ts +14 -0
  66. package/dist/types/tools.js +8 -0
  67. package/dist/types/tts.d.ts +108 -0
  68. package/dist/types/voice.d.ts +41 -4
  69. package/dist/utils/decisionAnswers.d.ts +31 -1
  70. package/dist/utils/decisionAnswers.js +114 -0
  71. package/dist/utils/decisionLimits.d.ts +39 -0
  72. package/dist/utils/decisionLimits.js +116 -0
  73. package/dist/utils/logger.d.ts +7 -0
  74. package/dist/utils/logger.js +9 -0
  75. package/dist/utils/messageBuilder.d.ts +45 -1
  76. package/dist/utils/messageBuilder.js +393 -16
  77. package/dist/utils/multimodalOptionsBuilder.d.ts +1 -0
  78. package/dist/utils/multimodalOptionsBuilder.js +1 -0
  79. package/dist/utils/speechText.d.ts +41 -0
  80. package/dist/utils/speechText.js +364 -0
  81. package/dist/utils/toolResultStatus.d.ts +26 -0
  82. package/dist/utils/toolResultStatus.js +73 -0
  83. package/dist/utils/ttsProcessor.d.ts +29 -0
  84. package/dist/utils/ttsProcessor.js +84 -2
  85. package/dist/voice/index.d.ts +1 -0
  86. package/dist/voice/index.js +3 -0
  87. package/dist/voice/providers/ElevenLabsSTT.d.ts +42 -0
  88. package/dist/voice/providers/ElevenLabsSTT.js +351 -0
  89. package/dist/voice/providers/ElevenLabsTTS.d.ts +81 -1
  90. package/dist/voice/providers/ElevenLabsTTS.js +415 -74
  91. package/docs-site/static/search-index.json +48 -33
  92. package/package.json +5 -2
  93. package/dist/utils/toolEndEmitter.d.ts +0 -25
  94. package/dist/utils/toolEndEmitter.js +0 -64
@@ -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 { DecisionOptions, DecisionResult, AgentDefinition, AgentNetworkConfig, AgentRunOptions, AgentRunOutcome, AgentToolRegistrationOptions, IsolatedAgentDefinition, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk, WorkerInstanceOptions } from "./types/index.js";
8
+ import type { DecisionCallerOptions, DecisionLimitsQuery, DecisionLimitsReading, 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";
@@ -173,6 +173,7 @@ export declare class NeuroLink {
173
173
  private readonly requestRouter;
174
174
  private readonly classifierRouter;
175
175
  private readonly contextRelevanceOptions;
176
+ private readonly decisionHooks;
176
177
  /**
177
178
  * Merge instance-level credentials with per-call credentials.
178
179
  *
@@ -199,6 +200,38 @@ export declare class NeuroLink {
199
200
  private cachedFileTools;
200
201
  private memoryInstance?;
201
202
  private memorySDKConfig?;
203
+ /**
204
+ * Set when the instance-level condensation prompt failed validation at
205
+ * construction (see initializeConversationMemory). Memory stays off for
206
+ * the instance's lifetime; the reason is what the warning already said.
207
+ */
208
+ private memoryDisabledReason?;
209
+ /**
210
+ * Dedicated child instance Hippocampus condenses through. Built on first
211
+ * condensation, never at construction — so a read-only host, or one whose
212
+ * memory never activates, never pays for a second NeuroLink.
213
+ */
214
+ private memoryCondenser?;
215
+ /**
216
+ * Set by `releaseMemoryCondenser()`, i.e. by `shutdown()` / `dispose()`,
217
+ * once the writes already scheduled have been drained. A memory write
218
+ * scheduled past that point must skip, and the condenser must never be
219
+ * rebuilt: a child resurrected after release would outlive its host,
220
+ * unreleased, and — after `dispose()` wiped the credentials — condense
221
+ * with none.
222
+ */
223
+ private memoryCondenserReleased;
224
+ /**
225
+ * Memory writes scheduled and not yet settled. `releaseMemoryCondenser()`
226
+ * awaits them (bounded) before it releases anything, so
227
+ * `await generate(); await shutdown();` — a serverless handler, a
228
+ * per-request instance, a one-shot CLI run — still stores its last turn.
229
+ */
230
+ private readonly pendingMemoryWrites;
231
+ /** Prompt templates already warned about, so a per-call template warns once. */
232
+ private readonly warnedCondensationPrompts;
233
+ /** `decisionHooks.hookTimeoutMs` once validated; see `decisionHookTimeout`. */
234
+ private decisionHookTimeoutMs?;
202
235
  private skillsManagerInstance?;
203
236
  private skillsConfig?;
204
237
  /**
@@ -212,6 +245,47 @@ export declare class NeuroLink {
212
245
  private applyGenerateLifecycleMiddleware;
213
246
  private applyStreamLifecycleMiddleware;
214
247
  private initializeMemoryConfig;
248
+ /**
249
+ * A `generate()`-only handle whose backing NeuroLink is constructed on the
250
+ * first condensation call, not when memory is configured or first read.
251
+ */
252
+ private lazyMemoryCondenserInstance;
253
+ /**
254
+ * Release the lazily created condenser with its host. Its own
255
+ * `shutdown()` is a no-op when condensation never ran; when it did, the
256
+ * child's memory is disabled and it holds no MCP servers, so this is
257
+ * cheap — the point is that the host's lifecycle owns the child's.
258
+ *
259
+ * The writes already scheduled are drained FIRST, bounded by the write
260
+ * timeout: a turn's memory write is deferred to `setImmediate`, so
261
+ * `await generate(); await shutdown();` would otherwise never store the
262
+ * turn. Only then is the host marked released, so a write scheduled after
263
+ * that point skips instead of rebuilding the child.
264
+ */
265
+ private releaseMemoryCondenser;
266
+ /**
267
+ * Wait for every scheduled memory write to settle, including writes
268
+ * scheduled while waiting, within one `MEMORY_WRITE_TIMEOUT_MS` budget.
269
+ * A write that outlives the budget is left in flight and warned about —
270
+ * it will skip or fail on its own once the condenser is gone — rather
271
+ * than hold shutdown open indefinitely.
272
+ */
273
+ private drainPendingMemoryWrites;
274
+ private warnMemoryWritesLeftInFlight;
275
+ /**
276
+ * The child instance Hippocampus condenses through, or null once the host
277
+ * has been released.
278
+ *
279
+ * Deliberately NOT `this`: routing condensation through the parent would
280
+ * run its MCP init, skills and middleware, emit `generation:*` on the
281
+ * parent emitter and add the condensation call's cost to
282
+ * `_sessionCostUsd`. The child inherits `credentials` (or the explicit
283
+ * `memory.neurolink.credentials`) so condensation no longer depends on
284
+ * provider keys in `process.env`, has memory disabled so it can never
285
+ * recurse into a memory write of its own, and — like createWorkerInstance —
286
+ * joins the host tracer without a second Langfuse exporter.
287
+ */
288
+ private getMemoryCondenser;
215
289
  /**
216
290
  * Lazy initialization for memory — called during generate/stream.
217
291
  */
@@ -324,6 +398,23 @@ export declare class NeuroLink {
324
398
  * Initialize conversation memory if enabled
325
399
  */
326
400
  private initializeConversationMemory;
401
+ /**
402
+ * Validate the condensation prompt template memory will condense with —
403
+ * the instance `prompt`, else `HC_CONDENSATION_PROMPT` (which Hippocampus
404
+ * reads when no config prompt is set). Hippocampus substitutes
405
+ * placeholders with `replaceAll` and requires none, so a template missing
406
+ * `{{NEW_CONTENT}}` yields a memory that never grows and one missing
407
+ * `{{OLD_MEMORY}}` overwrites the summary on every turn — both silently.
408
+ *
409
+ * Default is disable-and-log, matching every other memory failure; the
410
+ * log line is `error` because it is the only signal an operator gets that
411
+ * memory is off. With `memory.strictPrompt` the constructor throws instead.
412
+ *
413
+ * An empty or whitespace-only template counts as unset — Hippocampus
414
+ * resolves `config.prompt || HC_CONDENSATION_PROMPT || built-in`, so `""`
415
+ * means "use the next one down", never "a template with no placeholders".
416
+ */
417
+ private validateInstanceCondensationPrompt;
327
418
  /**
328
419
  * Initialize HITL (Human-in-the-Loop) if enabled
329
420
  */
@@ -427,10 +518,26 @@ export declare class NeuroLink {
427
518
  * Returns the input text enhanced with memory context, or unchanged if no memory.
428
519
  */
429
520
  private retrieveMemory;
521
+ /**
522
+ * Build the `add()` options for one memory owner. A per-owner prompt that
523
+ * fails template validation is dropped (warned once per distinct template)
524
+ * so that owner condenses with the instance prompt instead — Hippocampus
525
+ * resolves `options.prompt || this.prompt`, so omitting it is the fallback.
526
+ * An empty or whitespace-only prompt counts as unset and is omitted the
527
+ * same way, unvalidated: `""` already falls through in Hippocampus, but
528
+ * `" "` is truthy and would be used literally.
529
+ */
530
+ private resolveMemoryAddOptions;
430
531
  /**
431
532
  * Store a conversation turn in memory (non-blocking).
432
533
  * Calls add(userId, content) which internally condenses old + new via LLM.
433
534
  * Supports additional users with per-user prompt and maxWords overrides.
535
+ *
536
+ * The write hooks (`shouldWrite`, `onBeforeStore`; per-call wins over
537
+ * instance) run inside the deferred closure so an async hook never sits on
538
+ * the response path. A `false` / `null` verdict, a non-string transform or
539
+ * a thrown hook skips every `add()` for the turn — a missed memory is
540
+ * recoverable, a polluted condensed summary is not.
434
541
  */
435
542
  private storeMemoryInBackground;
436
543
  /**
@@ -845,11 +952,20 @@ export declare class NeuroLink {
845
952
  /**
846
953
  * Dependencies handed to every `ContextCompactor`.
847
954
  *
848
- * `tryDecide` returns null whenever no decision provider is configured or
955
+ * `siteDecide` returns null whenever no decision provider is configured or
849
956
  * the call fails, so passing this unconditionally is safe: the compactor
850
957
  * runs its previous pipeline unchanged and pays nothing for the option.
958
+ * `outer` is the request the compaction runs for — its credentials, abort
959
+ * signal and ids — so both decision stages go to the caller's account.
851
960
  */
852
961
  private contextCompactorDeps;
962
+ /**
963
+ * What a decide site inherits from the request it runs inside. Read off the
964
+ * request options so every site — routing, tool routing, both compaction
965
+ * stages — forwards the same fields the same way. The request id is the
966
+ * documented top-level `requestId` first, then `context.requestId`.
967
+ */
968
+ private decisionSiteContext;
853
969
  /**
854
970
  * Applies the host-configured `classifierRouter` to `options` in place.
855
971
  *
@@ -978,6 +1094,22 @@ export declare class NeuroLink {
978
1094
  private tryMCPGeneration;
979
1095
  private prepareMCPGenerationContext;
980
1096
  private logMCPConversationSummary;
1097
+ /**
1098
+ * The replay mode the budget check should size stored tool rows by: the
1099
+ * request's `replayToolSteps`, else the instance's, else the builder's
1100
+ * `"marker"` default — the same resolution BaseProvider applies before
1101
+ * building messages, so the estimate matches the prompt.
1102
+ *
1103
+ * Reach: every `checkContextBudget` call on the generate and stream paths,
1104
+ * including the post-compaction and post-truncation re-checks. It does NOT
1105
+ * reach the compactor's own stage gates or the summarizer's sizing
1106
+ * (`ContextCompactor`, `SummarizationEngine`): those still count tool rows
1107
+ * at stored size, so under `"marker"` / `"off"` a stage may prune or
1108
+ * summarize more history than the prompt would have carried. Threading the
1109
+ * mode into the compactor is a follow-up, tracked in
1110
+ * docs/features/context-compaction.md ("Context budget").
1111
+ */
1112
+ private resolveToolReplayModeForBudget;
981
1113
  private ensureMCPGenerationBudget;
982
1114
  private compactMCPConversationForBudget;
983
1115
  private generateWithMCPProvider;
@@ -2431,6 +2563,111 @@ export declare class NeuroLink {
2431
2563
  * @throws when no decision provider is configured, or the call fails
2432
2564
  */
2433
2565
  decide(options: DecisionOptions): Promise<DecisionResult>;
2566
+ /**
2567
+ * The provider a decision call will go to, resolved exactly as `decide()`
2568
+ * resolves it: an explicit name (or alias) wins, else the first configured
2569
+ * decision provider counting SDK credentials as well as the environment.
2570
+ */
2571
+ private resolveDecisionProviderName;
2572
+ /**
2573
+ * The model `decide()` sends when the caller names none: the one the
2574
+ * provider factory registered — `<PROVIDER>_MODEL` as it read at
2575
+ * registration, else the descriptor default. `decisionLimits()` must
2576
+ * report this same value rather than re-read the environment, or a
2577
+ * `LAYA_MODEL` changed after registration would size a state against one
2578
+ * checkpoint's window while the pre-flight check applies another's.
2579
+ * Before registration has run the registry is empty, and the factory will
2580
+ * read the environment when it does — so that read is returned here.
2581
+ */
2582
+ private registeredDecisionModel;
2583
+ /**
2584
+ * What the decision provider can read, resolved for one model — the same
2585
+ * figures the pre-flight refusal compares against, so a host can size the
2586
+ * questions it adds through `decisionHooks` (or a state it is about to
2587
+ * send) before the call instead of after the refusal.
2588
+ *
2589
+ * Provider resolution is `decide()`'s; the model is `query.model`, else
2590
+ * the model `decide()` would send (see `registeredDecisionModel`); the
2591
+ * per-model entry is flattened over the base. `enforcedLocally` says
2592
+ * whether NeuroLink refuses an over-limit request itself (Laya) or only
2593
+ * reports the server's ceiling (TypeSafe, whose limits are advisory).
2594
+ *
2595
+ * Returns null when no decision provider is configured and none is named —
2596
+ * parity with `tryDecide` — and for a provider that declares no limits.
2597
+ * A named provider is read whether or not it is configured: its limits are
2598
+ * facts about the model, not about this host's credentials.
2599
+ */
2600
+ decisionLimits(query?: DecisionLimitsQuery): DecisionLimitsReading | null;
2601
+ /**
2602
+ * `decisionHooks.hookTimeoutMs`, validated once per instance. A timer
2603
+ * honours delays from 1 to 2^31 − 1 ms and fires at once for anything
2604
+ * else — so `Infinity`, meant to lift the bound, would instead time every
2605
+ * hook out immediately, as would 0, NaN or a negative. Such a value falls
2606
+ * back to the default with one warning.
2607
+ */
2608
+ private decisionHookTimeout;
2609
+ /**
2610
+ * `EventEmitter.emit` runs listeners synchronously and rethrows whatever
2611
+ * they throw. A decision event is observe-only, so a throwing listener
2612
+ * must not be able to change the turn's routing or compaction outcome.
2613
+ */
2614
+ private emitDecisionEvent;
2615
+ /**
2616
+ * The one path every fail-open decision takes — a host's own `tryDecide`
2617
+ * and all five built-in sites (routing, tool routing, both compaction
2618
+ * stages, RAG planning) end up here.
2619
+ *
2620
+ * For a request stamped with a {@link DecisionSite} this is also where the
2621
+ * host's `decisionHooks` ride along:
2622
+ *
2623
+ * 1. `extendQuestions` may add questions; a throw is logged and ignored.
2624
+ * 2. Each host question is validated (invalid ones dropped, with a warning)
2625
+ * and namespaced `host__N` on the wire, so it can never collide with
2626
+ * NeuroLink's own ids (`difficulty`, `server__N`, `msg__N`, …).
2627
+ * 3. Additions are capped at the provider's `maxQuestions` minus
2628
+ * NeuroLink's own count. Without the cap a host adding one question too
2629
+ * many would have the WHOLE request refused, and NeuroLink's own routing
2630
+ * would silently degrade to the heuristic — the host's problem would
2631
+ * become NeuroLink's. A provider that declares no `maxQuestions`
2632
+ * (TypeSafe, XOR) takes every well-formed addition.
2633
+ * 4. Answers are split: the consumer sees only its own ids, exactly as it
2634
+ * would without hooks; `onAnswers` gets the host's answers under the
2635
+ * host's original ids plus the full result.
2636
+ *
2637
+ * The request's `images` and `video` ride along untouched — `merged` and
2638
+ * the wire call spread the request, and only `state`, the questions and
2639
+ * the result are cloned — so an XOR request keeps its Buffers and its
2640
+ * result keeps `mediaBytes`.
2641
+ *
2642
+ * `decision:before` / `decision:after` fire once per site call on the
2643
+ * instance emitter, observe-only, whether or not the call produced a
2644
+ * result. Without hooks and listeners, the decision payload — state and
2645
+ * questions — is exactly what the consumer built; the outer request's
2646
+ * per-call `credentials` are still forwarded, so the account and base URL
2647
+ * on the wire can differ from the instance's.
2648
+ *
2649
+ * Fail-open by construction, in three layers. Without a decision provider
2650
+ * nothing runs at all — no hook, no event — and the consumer gets the null
2651
+ * it always got. Everything a host can reach (its hook's return value, the
2652
+ * event payloads, the answer split, `onAnswers`) runs inside one `try`;
2653
+ * whatever a host throws, the consumer gets what `tryRunDecide` alone
2654
+ * would have given it. And every host-facing value is a `structuredClone`,
2655
+ * so a hook or listener that edits what it is handed edits neither the
2656
+ * wire request nor the consumer's own question objects.
2657
+ *
2658
+ * `outer` is what the surrounding `generate()` / `stream()` supplies —
2659
+ * per-call credentials, abort signal, ids — and wins over the same fields
2660
+ * on the request.
2661
+ */
2662
+ private siteDecide;
2663
+ /**
2664
+ * `decide()` proper. A request stamped with a site — every built-in
2665
+ * consumer's, and a host-wired consumer's — adds `decision.site` and
2666
+ * `decision.host_question_count` (the `host__N` ids the funnel namespaced)
2667
+ * to both spans, so a trace can tell a routing decision from a compaction
2668
+ * one and see how many questions the host rode along with.
2669
+ */
2670
+ private runDecide;
2434
2671
  /**
2435
2672
  * Fail-open {@link NeuroLink.decide}: returns null on any failure instead
2436
2673
  * of throwing.
@@ -2445,8 +2682,20 @@ export declare class NeuroLink {
2445
2682
  * back joined. A batch that fails costs only its own answers, which every
2446
2683
  * consumer already reads as "no decision"; null comes back only when every
2447
2684
  * batch failed. `decide()` itself stays strict and refuses an over-cap request.
2685
+ *
2686
+ * A request stamped with a `site` — every built-in consumer stamps its own,
2687
+ * so a `RAGPipeline` or `ClassifierRouter` a host wired to this method gets
2688
+ * the same treatment as NeuroLink's internal ones — also runs the host's
2689
+ * `decisionHooks` and emits `decision:before` / `decision:after`.
2690
+ */
2691
+ tryDecide(options: DecisionCallerOptions): Promise<DecisionResult | null>;
2692
+ /**
2693
+ * `tryDecide` without the site handling: the try/catch around the call.
2694
+ * Dispatches through `this.decide`, so a subclass override or an instance
2695
+ * patch on the public method sees every decision — the funnel's routing,
2696
+ * tool routing and compaction calls included, not only a host's own.
2448
2697
  */
2449
- tryDecide(options: DecisionOptions): Promise<DecisionResult | null>;
2698
+ private tryRunDecide;
2450
2699
  /**
2451
2700
  * One `decide()` call, or, when the question map is longer than the resolved
2452
2701
  * provider's cap, several run a few at a time with their results joined. The