@ethosagent/core 0.4.9 → 0.4.10
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/index.d.ts +1 -1
- package/dist/index.js +35 -9
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -416,7 +416,7 @@ interface AgentLoopConfig {
|
|
|
416
416
|
* Default streaming watchdog in milliseconds. If no chunk arrives from the
|
|
417
417
|
* LLM within this window, the agent aborts the stream and emits an error.
|
|
418
418
|
* Reset on every chunk. Personalities can override via
|
|
419
|
-
* `personality.streamingTimeoutMs`. Defaults to
|
|
419
|
+
* `personality.streamingTimeoutMs`. Defaults to 600000 (10 minutes).
|
|
420
420
|
*/
|
|
421
421
|
streamingTimeoutMs?: number;
|
|
422
422
|
};
|
package/dist/index.js
CHANGED
|
@@ -2218,7 +2218,7 @@ var AgentLoop = class {
|
|
|
2218
2218
|
this.resultBudgetChars = config.options?.resultBudgetChars ?? 8e4;
|
|
2219
2219
|
this.maxToolCallsPerTurn = config.options?.maxToolCallsPerTurn ?? 20;
|
|
2220
2220
|
this.maxIdenticalToolCalls = config.options?.maxIdenticalToolCalls ?? 5;
|
|
2221
|
-
this.streamingTimeoutMs = config.options?.streamingTimeoutMs ??
|
|
2221
|
+
this.streamingTimeoutMs = config.options?.streamingTimeoutMs ?? 6e5;
|
|
2222
2222
|
this.modelRouting = config.modelRouting ?? {};
|
|
2223
2223
|
this.memoryProviders = config.memoryProviders ?? /* @__PURE__ */ new Map();
|
|
2224
2224
|
if (config.storage) this.storage = config.storage;
|
|
@@ -2837,7 +2837,8 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2837
2837
|
llmMessages.push({ role: "assistant", content: chunkText });
|
|
2838
2838
|
break;
|
|
2839
2839
|
}
|
|
2840
|
-
const
|
|
2840
|
+
const progressQueue = [];
|
|
2841
|
+
let progressQueueResolve = null;
|
|
2841
2842
|
const scopedStorage = this.buildScopedStorage(personality);
|
|
2842
2843
|
let sessionMtimes = this.sessionReadMtimes.get(sessionKey);
|
|
2843
2844
|
if (!sessionMtimes) {
|
|
@@ -2860,12 +2861,14 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2860
2861
|
messageCount: allMessages.length + turnCount,
|
|
2861
2862
|
abortSignal,
|
|
2862
2863
|
emit: (event) => {
|
|
2863
|
-
|
|
2864
|
+
progressQueue.push({
|
|
2864
2865
|
toolName: event.toolName,
|
|
2865
2866
|
message: event.message,
|
|
2866
2867
|
...event.percent !== void 0 && { percent: event.percent },
|
|
2867
2868
|
audience: event.audience ?? "internal"
|
|
2868
2869
|
});
|
|
2870
|
+
progressQueueResolve?.();
|
|
2871
|
+
progressQueueResolve = null;
|
|
2869
2872
|
},
|
|
2870
2873
|
resultBudgetChars: this.resultBudgetChars,
|
|
2871
2874
|
readMtimes: sessionMtimes,
|
|
@@ -3021,13 +3024,40 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
3021
3024
|
}
|
|
3022
3025
|
const execInputs = prepped.filter((p) => p.rejected === void 0).map((p) => ({ toolCallId: p.toolCallId, name: p.name, args: p.args }));
|
|
3023
3026
|
const startedAt = Date.now();
|
|
3024
|
-
|
|
3027
|
+
let toolsDone = false;
|
|
3028
|
+
const toolsPromise = execInputs.length > 0 ? this.tools.executeParallel(
|
|
3025
3029
|
execInputs,
|
|
3026
3030
|
toolCtxBase,
|
|
3027
3031
|
allowedTools,
|
|
3028
3032
|
filterOpts,
|
|
3029
3033
|
opts.attachments
|
|
3030
|
-
) : [];
|
|
3034
|
+
) : Promise.resolve([]);
|
|
3035
|
+
toolsPromise.then(
|
|
3036
|
+
() => {
|
|
3037
|
+
toolsDone = true;
|
|
3038
|
+
progressQueueResolve?.();
|
|
3039
|
+
progressQueueResolve = null;
|
|
3040
|
+
},
|
|
3041
|
+
() => {
|
|
3042
|
+
toolsDone = true;
|
|
3043
|
+
progressQueueResolve?.();
|
|
3044
|
+
progressQueueResolve = null;
|
|
3045
|
+
}
|
|
3046
|
+
);
|
|
3047
|
+
while (!toolsDone || progressQueue.length > 0) {
|
|
3048
|
+
while (progressQueue.length > 0) {
|
|
3049
|
+
const ev = progressQueue.shift();
|
|
3050
|
+
if (ev) {
|
|
3051
|
+
yield { type: "tool_progress", ...ev };
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
if (!toolsDone) {
|
|
3055
|
+
await new Promise((r) => {
|
|
3056
|
+
progressQueueResolve = r;
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
const execResults = await toolsPromise;
|
|
3031
3061
|
const execResultMap = new Map(execResults.map((r) => [r.toolCallId, r]));
|
|
3032
3062
|
const directResult = execResults.find((r) => {
|
|
3033
3063
|
const t = this.tools.get(r.name);
|
|
@@ -3088,10 +3118,6 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
3088
3118
|
}
|
|
3089
3119
|
}
|
|
3090
3120
|
}
|
|
3091
|
-
for (const ev of progressBuffer) {
|
|
3092
|
-
yield { type: "tool_progress", ...ev };
|
|
3093
|
-
}
|
|
3094
|
-
progressBuffer.length = 0;
|
|
3095
3121
|
const toolResultContent = [];
|
|
3096
3122
|
let untrustedReadThisIteration = false;
|
|
3097
3123
|
for (const p of prepped) {
|