@nuvin/nuvin-core 1.6.2 → 1.7.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/dist/VERSION +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -5
- package/package.json +1 -1
package/dist/VERSION
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type AgentTemplate = {
|
|
|
17
17
|
topP?: number;
|
|
18
18
|
timeoutMs?: number;
|
|
19
19
|
shareContext?: boolean;
|
|
20
|
+
stream?: boolean;
|
|
20
21
|
metadata?: Record<string, unknown>;
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
@@ -40,6 +41,7 @@ type SpecialistAgentConfig = {
|
|
|
40
41
|
topP?: number;
|
|
41
42
|
timeoutMs?: number;
|
|
42
43
|
shareContext?: boolean;
|
|
44
|
+
stream?: boolean;
|
|
43
45
|
delegatingMemory?: Message[];
|
|
44
46
|
delegationDepth: number;
|
|
45
47
|
conversationId?: string;
|
|
@@ -1691,6 +1693,7 @@ type FileNewSuccessResult$1 = {
|
|
|
1691
1693
|
metadata: {
|
|
1692
1694
|
file_path: string;
|
|
1693
1695
|
bytes: number;
|
|
1696
|
+
lines: number;
|
|
1694
1697
|
created: string;
|
|
1695
1698
|
overwritten?: boolean;
|
|
1696
1699
|
};
|
package/dist/index.js
CHANGED
|
@@ -964,6 +964,20 @@ var AgentOrchestrator = class {
|
|
|
964
964
|
};
|
|
965
965
|
turnHistory.push(toolMsg);
|
|
966
966
|
toolResultMsgs.push(toolMsg);
|
|
967
|
+
await this.events?.emit({
|
|
968
|
+
type: AgentEventTypes.ToolResult,
|
|
969
|
+
conversationId,
|
|
970
|
+
messageId,
|
|
971
|
+
result: {
|
|
972
|
+
id: toolCall.id,
|
|
973
|
+
name: toolCall.function.name,
|
|
974
|
+
status: "error",
|
|
975
|
+
type: "text",
|
|
976
|
+
result: toolDenialResult,
|
|
977
|
+
durationMs: 0,
|
|
978
|
+
metadata: { errorReason: "denied" /* Denied */ }
|
|
979
|
+
}
|
|
980
|
+
});
|
|
967
981
|
}
|
|
968
982
|
await this.memory.append(conversationId, [assistantMsg, ...toolResultMsgs]);
|
|
969
983
|
await this.events?.emit({
|
|
@@ -2651,10 +2665,12 @@ var FileNewTool = class {
|
|
|
2651
2665
|
const existsBefore = await fs4.stat(abs).then(() => true).catch(() => false);
|
|
2652
2666
|
await fs4.mkdir(path4.dirname(abs), { recursive: true });
|
|
2653
2667
|
const bytes = Buffer.from(p.content, "utf8");
|
|
2668
|
+
const lines = p.content.split(/\r?\n/).length;
|
|
2654
2669
|
await this.writeAtomic(abs, bytes);
|
|
2655
2670
|
return okText(`File written at ${p.file_path}.`, {
|
|
2656
2671
|
file_path: p.file_path,
|
|
2657
2672
|
bytes: bytes.length,
|
|
2673
|
+
lines,
|
|
2658
2674
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2659
2675
|
overwritten: existsBefore
|
|
2660
2676
|
});
|
|
@@ -3674,6 +3690,7 @@ var DefaultSpecialistAgentFactory = class {
|
|
|
3674
3690
|
topP: template.topP,
|
|
3675
3691
|
timeoutMs: template.timeoutMs,
|
|
3676
3692
|
shareContext: template.shareContext ?? false,
|
|
3693
|
+
stream: template.stream ?? true,
|
|
3677
3694
|
delegatingMemory: void 0,
|
|
3678
3695
|
// TODO: provide delegating memory when available
|
|
3679
3696
|
delegationDepth: input.currentDepth + 1,
|
|
@@ -3830,7 +3847,7 @@ var AgentManager = class {
|
|
|
3830
3847
|
this.activeAgents.set(agentId, specialistOrchestrator);
|
|
3831
3848
|
try {
|
|
3832
3849
|
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
3833
|
-
const response = await this.executeWithTimeout(specialistOrchestrator, config.taskDescription, timeoutMs, signal);
|
|
3850
|
+
const response = await this.executeWithTimeout(specialistOrchestrator, config.taskDescription, timeoutMs, signal, config.stream);
|
|
3834
3851
|
const executionTimeMs = Date.now() - startTime;
|
|
3835
3852
|
const conversationHistory = await memory.get("default");
|
|
3836
3853
|
const toolCallsExecuted = events.filter((e) => e.type === "tool_calls").length;
|
|
@@ -3912,7 +3929,7 @@ var AgentManager = class {
|
|
|
3912
3929
|
/**
|
|
3913
3930
|
* Execute agent task with timeout
|
|
3914
3931
|
*/
|
|
3915
|
-
async executeWithTimeout(orchestrator, taskDescription, timeoutMs, signal) {
|
|
3932
|
+
async executeWithTimeout(orchestrator, taskDescription, timeoutMs, signal, stream) {
|
|
3916
3933
|
const timeoutController = new AbortController();
|
|
3917
3934
|
const combinedSignal = signal ? AbortSignal.any([signal, timeoutController.signal]) : timeoutController.signal;
|
|
3918
3935
|
let timer;
|
|
@@ -3920,7 +3937,8 @@ var AgentManager = class {
|
|
|
3920
3937
|
return await Promise.race([
|
|
3921
3938
|
orchestrator.send(taskDescription, {
|
|
3922
3939
|
conversationId: "default",
|
|
3923
|
-
signal: combinedSignal
|
|
3940
|
+
signal: combinedSignal,
|
|
3941
|
+
stream
|
|
3924
3942
|
}),
|
|
3925
3943
|
new Promise((_, reject) => {
|
|
3926
3944
|
if (signal?.aborted) {
|
|
@@ -4725,9 +4743,9 @@ var BaseLLM = class {
|
|
|
4725
4743
|
model: enhancedParams.model,
|
|
4726
4744
|
messages: enhancedParams.messages,
|
|
4727
4745
|
temperature: enhancedParams.temperature,
|
|
4728
|
-
max_tokens: enhancedParams.maxTokens,
|
|
4729
4746
|
top_p: enhancedParams.topP,
|
|
4730
4747
|
stream: false,
|
|
4748
|
+
...enhancedParams.maxTokens !== void 0 && { max_tokens: enhancedParams.maxTokens },
|
|
4731
4749
|
...enhancedParams.reasoning && { reasoning: enhancedParams.reasoning },
|
|
4732
4750
|
...enhancedParams.usage && { usage: enhancedParams.usage }
|
|
4733
4751
|
};
|
|
@@ -4751,9 +4769,9 @@ var BaseLLM = class {
|
|
|
4751
4769
|
model: enhancedParams.model,
|
|
4752
4770
|
messages: enhancedParams.messages,
|
|
4753
4771
|
temperature: enhancedParams.temperature,
|
|
4754
|
-
max_tokens: enhancedParams.maxTokens,
|
|
4755
4772
|
top_p: enhancedParams.topP,
|
|
4756
4773
|
stream: true,
|
|
4774
|
+
...enhancedParams.maxTokens !== void 0 && { max_tokens: enhancedParams.maxTokens },
|
|
4757
4775
|
...enhancedParams.reasoning && { reasoning: enhancedParams.reasoning },
|
|
4758
4776
|
...enhancedParams.usage && { usage: enhancedParams.usage }
|
|
4759
4777
|
};
|