@ethosagent/core 0.4.9 → 0.4.11
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 +2 -1
- package/dist/index.js +38 -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
|
};
|
|
@@ -697,6 +697,7 @@ declare class InMemorySessionStore implements SessionStore {
|
|
|
697
697
|
}>;
|
|
698
698
|
recordCompactionTurn(sessionId: string, turnNumber: number): Promise<void>;
|
|
699
699
|
pruneOldSessions(olderThan: Date): Promise<number>;
|
|
700
|
+
undoTurns(_sessionId: string, _n: number): Promise<number>;
|
|
700
701
|
vacuum(): Promise<void>;
|
|
701
702
|
}
|
|
702
703
|
|
package/dist/index.js
CHANGED
|
@@ -921,6 +921,9 @@ var InMemorySessionStore = class {
|
|
|
921
921
|
}
|
|
922
922
|
return count;
|
|
923
923
|
}
|
|
924
|
+
async undoTurns(_sessionId, _n) {
|
|
925
|
+
return 0;
|
|
926
|
+
}
|
|
924
927
|
async vacuum() {
|
|
925
928
|
}
|
|
926
929
|
};
|
|
@@ -2218,7 +2221,7 @@ var AgentLoop = class {
|
|
|
2218
2221
|
this.resultBudgetChars = config.options?.resultBudgetChars ?? 8e4;
|
|
2219
2222
|
this.maxToolCallsPerTurn = config.options?.maxToolCallsPerTurn ?? 20;
|
|
2220
2223
|
this.maxIdenticalToolCalls = config.options?.maxIdenticalToolCalls ?? 5;
|
|
2221
|
-
this.streamingTimeoutMs = config.options?.streamingTimeoutMs ??
|
|
2224
|
+
this.streamingTimeoutMs = config.options?.streamingTimeoutMs ?? 6e5;
|
|
2222
2225
|
this.modelRouting = config.modelRouting ?? {};
|
|
2223
2226
|
this.memoryProviders = config.memoryProviders ?? /* @__PURE__ */ new Map();
|
|
2224
2227
|
if (config.storage) this.storage = config.storage;
|
|
@@ -2837,7 +2840,8 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2837
2840
|
llmMessages.push({ role: "assistant", content: chunkText });
|
|
2838
2841
|
break;
|
|
2839
2842
|
}
|
|
2840
|
-
const
|
|
2843
|
+
const progressQueue = [];
|
|
2844
|
+
let progressQueueResolve = null;
|
|
2841
2845
|
const scopedStorage = this.buildScopedStorage(personality);
|
|
2842
2846
|
let sessionMtimes = this.sessionReadMtimes.get(sessionKey);
|
|
2843
2847
|
if (!sessionMtimes) {
|
|
@@ -2860,12 +2864,14 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
2860
2864
|
messageCount: allMessages.length + turnCount,
|
|
2861
2865
|
abortSignal,
|
|
2862
2866
|
emit: (event) => {
|
|
2863
|
-
|
|
2867
|
+
progressQueue.push({
|
|
2864
2868
|
toolName: event.toolName,
|
|
2865
2869
|
message: event.message,
|
|
2866
2870
|
...event.percent !== void 0 && { percent: event.percent },
|
|
2867
2871
|
audience: event.audience ?? "internal"
|
|
2868
2872
|
});
|
|
2873
|
+
progressQueueResolve?.();
|
|
2874
|
+
progressQueueResolve = null;
|
|
2869
2875
|
},
|
|
2870
2876
|
resultBudgetChars: this.resultBudgetChars,
|
|
2871
2877
|
readMtimes: sessionMtimes,
|
|
@@ -3021,13 +3027,40 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
3021
3027
|
}
|
|
3022
3028
|
const execInputs = prepped.filter((p) => p.rejected === void 0).map((p) => ({ toolCallId: p.toolCallId, name: p.name, args: p.args }));
|
|
3023
3029
|
const startedAt = Date.now();
|
|
3024
|
-
|
|
3030
|
+
let toolsDone = false;
|
|
3031
|
+
const toolsPromise = execInputs.length > 0 ? this.tools.executeParallel(
|
|
3025
3032
|
execInputs,
|
|
3026
3033
|
toolCtxBase,
|
|
3027
3034
|
allowedTools,
|
|
3028
3035
|
filterOpts,
|
|
3029
3036
|
opts.attachments
|
|
3030
|
-
) : [];
|
|
3037
|
+
) : Promise.resolve([]);
|
|
3038
|
+
toolsPromise.then(
|
|
3039
|
+
() => {
|
|
3040
|
+
toolsDone = true;
|
|
3041
|
+
progressQueueResolve?.();
|
|
3042
|
+
progressQueueResolve = null;
|
|
3043
|
+
},
|
|
3044
|
+
() => {
|
|
3045
|
+
toolsDone = true;
|
|
3046
|
+
progressQueueResolve?.();
|
|
3047
|
+
progressQueueResolve = null;
|
|
3048
|
+
}
|
|
3049
|
+
);
|
|
3050
|
+
while (!toolsDone || progressQueue.length > 0) {
|
|
3051
|
+
while (progressQueue.length > 0) {
|
|
3052
|
+
const ev = progressQueue.shift();
|
|
3053
|
+
if (ev) {
|
|
3054
|
+
yield { type: "tool_progress", ...ev };
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
if (!toolsDone) {
|
|
3058
|
+
await new Promise((r) => {
|
|
3059
|
+
progressQueueResolve = r;
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
const execResults = await toolsPromise;
|
|
3031
3064
|
const execResultMap = new Map(execResults.map((r) => [r.toolCallId, r]));
|
|
3032
3065
|
const directResult = execResults.find((r) => {
|
|
3033
3066
|
const t = this.tools.get(r.name);
|
|
@@ -3088,10 +3121,6 @@ ${rendered.slice(-MEMORY_MAX_CHARS)}`;
|
|
|
3088
3121
|
}
|
|
3089
3122
|
}
|
|
3090
3123
|
}
|
|
3091
|
-
for (const ev of progressBuffer) {
|
|
3092
|
-
yield { type: "tool_progress", ...ev };
|
|
3093
|
-
}
|
|
3094
|
-
progressBuffer.length = 0;
|
|
3095
3124
|
const toolResultContent = [];
|
|
3096
3125
|
let untrustedReadThisIteration = false;
|
|
3097
3126
|
for (const p of prepped) {
|