@ai-setting/roy-agent-core 1.5.67 → 1.5.68
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/env/agent/index.js +1 -1
- package/dist/env/index.js +2 -2
- package/dist/env/session/index.js +1 -1
- package/dist/index.js +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-marga2es.js → roy-agent-core-08q02yz2.js} +4 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hkeegfq0.js → roy-agent-core-jkzgmd1v.js} +14 -7
- package/dist/shared/@ai-setting/{roy-agent-core-v61w8cmf.js → roy-agent-core-zm86k3rg.js} +3 -0
- package/package.json +1 -1
package/dist/env/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-08q02yz2.js";
|
|
5
5
|
import"../../shared/@ai-setting/roy-agent-core-ecth1zak.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
package/dist/env/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-zm86k3rg.js";
|
|
4
4
|
import {
|
|
5
5
|
EventSourceComponent,
|
|
6
6
|
builtInHandlers,
|
|
@@ -39,7 +39,7 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
39
39
|
import {
|
|
40
40
|
AgentComponent,
|
|
41
41
|
AgentComponentConfigSchema
|
|
42
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
42
|
+
} from "../shared/@ai-setting/roy-agent-core-08q02yz2.js";
|
|
43
43
|
import"../shared/@ai-setting/roy-agent-core-ecth1zak.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
45
45
|
import {
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
BaseEnvironment,
|
|
58
58
|
generateDescendingId,
|
|
59
59
|
generateId
|
|
60
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
60
|
+
} from "./shared/@ai-setting/roy-agent-core-zm86k3rg.js";
|
|
61
61
|
import {
|
|
62
62
|
EventSourceComponent,
|
|
63
63
|
builtInHandlers,
|
|
@@ -116,7 +116,7 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
116
116
|
import {
|
|
117
117
|
AgentComponent,
|
|
118
118
|
AgentComponentConfigSchema
|
|
119
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
119
|
+
} from "./shared/@ai-setting/roy-agent-core-08q02yz2.js";
|
|
120
120
|
import {
|
|
121
121
|
createInvokeConfig,
|
|
122
122
|
invoke,
|
|
@@ -171,7 +171,7 @@ import"./shared/@ai-setting/roy-agent-core-fnv3ev18.js";
|
|
|
171
171
|
import"./shared/@ai-setting/roy-agent-core-djtkntar.js";
|
|
172
172
|
import {
|
|
173
173
|
SessionComponent
|
|
174
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
174
|
+
} from "./shared/@ai-setting/roy-agent-core-jkzgmd1v.js";
|
|
175
175
|
import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
176
176
|
import {
|
|
177
177
|
MemorySessionStore
|
|
@@ -794,7 +794,7 @@ class AgentComponent extends BaseComponent {
|
|
|
794
794
|
} catch (error) {
|
|
795
795
|
logger.error(`Iteration ${iteration} error`, { error });
|
|
796
796
|
hookCtx.error = error instanceof Error ? error : new Error(String(error));
|
|
797
|
-
if (error instanceof
|
|
797
|
+
if (error instanceof ContextError && error.llmOutput) {
|
|
798
798
|
const llmOutput = error.llmOutput;
|
|
799
799
|
if (llmOutput.toolCalls?.length) {
|
|
800
800
|
const assistantParts = [];
|
|
@@ -877,6 +877,9 @@ class AgentComponent extends BaseComponent {
|
|
|
877
877
|
result.error = `__ASK_USER_ERROR__:${JSON.stringify(errorInfo)}`;
|
|
878
878
|
} else {
|
|
879
879
|
result.error = hookCtx.error.message;
|
|
880
|
+
if (error instanceof Error) {
|
|
881
|
+
result.originalError = error;
|
|
882
|
+
}
|
|
880
883
|
if (error?.name === "AbortError") {
|
|
881
884
|
hookCtx._stopReason = hookCtx._stopReason || "aborted";
|
|
882
885
|
} else {
|
|
@@ -450,12 +450,19 @@ class SessionComponent extends BaseComponent {
|
|
|
450
450
|
const recentMessages = this.extractRecentMessages(messages, 2);
|
|
451
451
|
this.ensureSummaryAgent();
|
|
452
452
|
await this.executeBeforeHooks("compact", { session, options });
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
453
|
+
let summaryResult;
|
|
454
|
+
try {
|
|
455
|
+
summaryResult = await this.summaryAgent.run({
|
|
456
|
+
messages: messages.map((m) => ({ role: m.role, content: m.content })),
|
|
457
|
+
userContext: options?.summary,
|
|
458
|
+
outputFormat: "json",
|
|
459
|
+
scenarioHint: options?.scenarioHint
|
|
460
|
+
});
|
|
461
|
+
} catch (error) {
|
|
462
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
463
|
+
logger.error(`[SessionComponent] SummaryAgent.run failed: ${errorMessage}`);
|
|
464
|
+
throw new Error(`Session compaction failed: SummaryAgent error - ${errorMessage}`);
|
|
465
|
+
}
|
|
459
466
|
const checkpointId = `cp_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 8)}`;
|
|
460
467
|
const checkpoint = {
|
|
461
468
|
id: checkpointId,
|
|
@@ -476,9 +483,9 @@ class SessionComponent extends BaseComponent {
|
|
|
476
483
|
recentMessages
|
|
477
484
|
};
|
|
478
485
|
await this.store.saveCheckpoint(sessionId, checkpoint);
|
|
479
|
-
await this.store.archiveMessages(sessionId, checkpointId, messages.length);
|
|
480
486
|
const checkpointMessage = this.createCheckpointMessage(checkpoint);
|
|
481
487
|
await this.store.addMessage(sessionId, checkpointMessage);
|
|
488
|
+
await this.store.archiveMessages(sessionId, checkpointId, messages.length);
|
|
482
489
|
const updatedSession = await this.get(sessionId);
|
|
483
490
|
const remainingMessageCount = updatedSession?.messageCount ?? 0;
|
|
484
491
|
const checkpointCount = updatedSession?.metadata?.checkpoints?.checkpoints?.length ?? 0;
|
|
@@ -225,6 +225,9 @@ class BaseEnvironment extends BaseComponent {
|
|
|
225
225
|
}
|
|
226
226
|
const result = await agentComponent.run(agent.name, query, context);
|
|
227
227
|
if (result.error) {
|
|
228
|
+
if (result.originalError instanceof ContextError) {
|
|
229
|
+
throw result.originalError;
|
|
230
|
+
}
|
|
228
231
|
const errorMsg = result.error.toLowerCase();
|
|
229
232
|
if (errorMsg.includes("context") || errorMsg.includes("threshold") || errorMsg.includes("token") || result.error.includes("CTX_001")) {
|
|
230
233
|
const usageMatch = result.error.match(/(\d+)\/(\d+)\s*\(([\d.]+)%\)/);
|