@juspay/neurolink 10.5.2 → 10.6.0
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 +12 -0
- package/dist/agent/agent.js +39 -8
- package/dist/agent/agentNetwork.js +62 -20
- package/dist/agent/agentToolRegistrar.d.ts +48 -0
- package/dist/agent/agentToolRegistrar.js +336 -0
- package/dist/agent/index.d.ts +3 -0
- package/dist/agent/index.js +4 -0
- package/dist/agent/isolatedAgentRunner.d.ts +73 -0
- package/dist/agent/isolatedAgentRunner.js +946 -0
- package/dist/agent/structuredRecovery.d.ts +30 -0
- package/dist/agent/structuredRecovery.js +104 -0
- package/dist/browser/neurolink.min.js +414 -398
- package/dist/cli/loop/optionsSchema.d.ts +1 -1
- package/dist/core/baseProvider.d.ts +8 -0
- package/dist/core/baseProvider.js +40 -19
- package/dist/core/modules/GenerationHandler.d.ts +2 -6
- package/dist/core/modules/GenerationHandler.js +10 -1
- package/dist/core/toolExecutionRecorder.d.ts +76 -0
- package/dist/core/toolExecutionRecorder.js +261 -0
- package/dist/evaluation/contextBuilder.js +6 -6
- package/dist/lib/agent/agent.js +39 -8
- package/dist/lib/agent/agentNetwork.js +62 -20
- package/dist/lib/agent/agentToolRegistrar.d.ts +48 -0
- package/dist/lib/agent/agentToolRegistrar.js +337 -0
- package/dist/lib/agent/index.d.ts +3 -0
- package/dist/lib/agent/index.js +4 -0
- package/dist/lib/agent/isolatedAgentRunner.d.ts +73 -0
- package/dist/lib/agent/isolatedAgentRunner.js +947 -0
- package/dist/lib/agent/structuredRecovery.d.ts +30 -0
- package/dist/lib/agent/structuredRecovery.js +105 -0
- package/dist/lib/core/baseProvider.d.ts +8 -0
- package/dist/lib/core/baseProvider.js +40 -19
- package/dist/lib/core/modules/GenerationHandler.d.ts +2 -6
- package/dist/lib/core/modules/GenerationHandler.js +10 -1
- package/dist/lib/core/toolExecutionRecorder.d.ts +76 -0
- package/dist/lib/core/toolExecutionRecorder.js +262 -0
- package/dist/lib/evaluation/contextBuilder.js +6 -6
- package/dist/lib/models/modelRegistry.d.ts +23 -0
- package/dist/lib/models/modelRegistry.js +62 -1
- package/dist/lib/models/modelResolver.js +1 -0
- package/dist/lib/neurolink.d.ts +80 -1
- package/dist/lib/neurolink.js +199 -37
- package/dist/lib/providers/amazonBedrock.js +15 -2
- package/dist/lib/providers/anthropic.js +23 -11
- package/dist/lib/providers/googleAiStudio.js +8 -1
- package/dist/lib/providers/googleNativeGemini3.d.ts +2 -0
- package/dist/lib/providers/googleNativeGemini3.js +8 -1
- package/dist/lib/providers/googleVertex.js +56 -16
- package/dist/lib/providers/openaiChatCompletionsClient.js +18 -5
- package/dist/lib/tasks/autoresearchTaskExecutor.js +7 -6
- package/dist/lib/tasks/taskExecutor.js +2 -5
- package/dist/lib/types/agentNetwork.d.ts +23 -8
- package/dist/lib/types/generate.d.ts +62 -5
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.js +1 -0
- package/dist/lib/types/isolatedAgent.d.ts +365 -0
- package/dist/lib/types/isolatedAgent.js +12 -0
- package/dist/lib/types/model.d.ts +8 -0
- package/dist/lib/types/stream.d.ts +3 -1
- package/dist/lib/types/task.d.ts +3 -3
- package/dist/lib/utils/logger.d.ts +12 -3
- package/dist/lib/utils/logger.js +11 -3
- package/dist/lib/utils/transformationUtils.d.ts +14 -0
- package/dist/lib/utils/transformationUtils.js +33 -10
- package/dist/lib/voice/livekit/realtimeVoiceAgent.js +6 -3
- package/dist/models/modelRegistry.d.ts +23 -0
- package/dist/models/modelRegistry.js +62 -1
- package/dist/models/modelResolver.js +1 -0
- package/dist/neurolink.d.ts +80 -1
- package/dist/neurolink.js +199 -37
- package/dist/providers/amazonBedrock.js +15 -2
- package/dist/providers/anthropic.js +23 -11
- package/dist/providers/googleAiStudio.js +8 -1
- package/dist/providers/googleNativeGemini3.d.ts +2 -0
- package/dist/providers/googleNativeGemini3.js +8 -1
- package/dist/providers/googleVertex.js +56 -16
- package/dist/providers/openaiChatCompletionsClient.js +18 -5
- package/dist/tasks/autoresearchTaskExecutor.js +7 -6
- package/dist/tasks/taskExecutor.js +2 -5
- package/dist/types/agentNetwork.d.ts +23 -8
- package/dist/types/generate.d.ts +62 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/isolatedAgent.d.ts +365 -0
- package/dist/types/isolatedAgent.js +11 -0
- package/dist/types/model.d.ts +8 -0
- package/dist/types/stream.d.ts +3 -1
- package/dist/types/task.d.ts +3 -3
- package/dist/utils/logger.d.ts +12 -3
- package/dist/utils/logger.js +11 -3
- package/dist/utils/transformationUtils.d.ts +14 -0
- package/dist/utils/transformationUtils.js +33 -10
- package/dist/voice/livekit/realtimeVoiceAgent.js +6 -3
- package/package.json +3 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runIsolatedAgent() — the production sub-agent runner.
|
|
3
|
+
*
|
|
4
|
+
* One function replacing what every consumer hand-rolled on top of
|
|
5
|
+
* generate(): a worker-mode instance (memory off, orchestration off,
|
|
6
|
+
* observability inherited), a tool-using research pass under the turn budget
|
|
7
|
+
* (wrap-up nudge + stall watchdog + honest stopReason), an extraction pass
|
|
8
|
+
* that ALWAYS runs tools-off on its own timeout, a structured-recovery
|
|
9
|
+
* ladder with corrective re-asks, a delivery guarantee (non-empty execution
|
|
10
|
+
* records never produce an empty result), abort chaining, a lifecycle event
|
|
11
|
+
* stream, leashed legs with TTL'd resume handles, and mechanical
|
|
12
|
+
* waste-signature detection.
|
|
13
|
+
*
|
|
14
|
+
* Behavioral contract: docs/plans/2026-07-27-isolated-agent-runner-rfc.md.
|
|
15
|
+
*/
|
|
16
|
+
import type { NeuroLink } from "../neurolink.js";
|
|
17
|
+
import type { AgentRunOptions, AgentRunOutcome, IsolatedAgentDefinition, ToolExecutionRecord } from "../types/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* True when the SAME host + caller session already has an open (live)
|
|
20
|
+
* leashed handle for this agent definition.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately narrow: a handle belongs to the conversation that opened it,
|
|
23
|
+
* so the conflict only exists when the caller-supplied `sessionId` matches —
|
|
24
|
+
* a multi-tenant host must never refuse thread B because thread A has an
|
|
25
|
+
* in-flight leg (thread B cannot see, continue, or legitimately steer that
|
|
26
|
+
* handle). Callers without a stable sessionId get no conflict detection;
|
|
27
|
+
* cross-session concurrency is the delegation pool's job.
|
|
28
|
+
*/
|
|
29
|
+
export declare function hasOpenIsolatedAgentHandle(host: unknown, definitionId: string, callerSessionId?: string): {
|
|
30
|
+
open: boolean;
|
|
31
|
+
handle?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Mechanical digest of a run's execution records: which tools ran, ok/failed
|
|
35
|
+
* counts, and bounded excerpts of successful payloads. The delivery
|
|
36
|
+
* guarantee's last line of defense — a non-empty execution record can never
|
|
37
|
+
* produce an empty result.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildMechanicalDigest(records: ToolExecutionRecord[]): {
|
|
40
|
+
kind: "mechanical-digest";
|
|
41
|
+
toolsRun: Record<string, {
|
|
42
|
+
calls: number;
|
|
43
|
+
ok: number;
|
|
44
|
+
failed: number;
|
|
45
|
+
}>;
|
|
46
|
+
excerpts: Array<{
|
|
47
|
+
toolName: string;
|
|
48
|
+
params: string;
|
|
49
|
+
resultText: string;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Run an isolated sub-agent: research pass with tools under the turn budget,
|
|
54
|
+
* extraction pass tools-off on its own timeout, structured recovery,
|
|
55
|
+
* delivery guarantee, abort chaining, events, and (when `options.leg` is
|
|
56
|
+
* set) leashed legs with a TTL'd resume handle.
|
|
57
|
+
*/
|
|
58
|
+
export declare function runIsolatedAgent(host: NeuroLink, definition: IsolatedAgentDefinition, input: string | Record<string, unknown>, options?: AgentRunOptions): Promise<AgentRunOutcome>;
|
|
59
|
+
/**
|
|
60
|
+
* Resume a leashed run. `guidance`, when provided, is appended as a user
|
|
61
|
+
* turn before the next leg — this is how a supervisor re-steers a drifting
|
|
62
|
+
* worker. An expired handle returns its tombstoned final outcome once.
|
|
63
|
+
* Handles are owned by the host that created them; a handle with a leg
|
|
64
|
+
* already in flight refuses a second continuation instead of racing it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function continueIsolatedAgent(host: NeuroLink, handle: string, guidance?: string): Promise<AgentRunOutcome>;
|
|
67
|
+
/**
|
|
68
|
+
* Stop a leashed run: dispose the worker and return the final outcome
|
|
69
|
+
* (mechanical digest over everything gathered so far). Refuses while a leg
|
|
70
|
+
* is in flight — cancel an in-flight leg via the run's `abortSignal` instead
|
|
71
|
+
* of disposing its worker mid-generate.
|
|
72
|
+
*/
|
|
73
|
+
export declare function stopIsolatedAgent(host: NeuroLink, handle: string): Promise<AgentRunOutcome>;
|