@ai-setting/roy-agent-core 1.7.48 → 1.7.49
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/config/index.js +7 -7
- package/dist/env/agent/index.js +10 -10
- package/dist/env/commands/index.js +7 -7
- package/dist/env/context/index.js +3 -3
- package/dist/env/debug/index.js +7 -7
- package/dist/env/event-source/index.js +13 -13
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +33 -32
- package/dist/env/llm/index.js +7 -7
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/mcp/index.js +7 -7
- package/dist/env/memory/index.js +7 -7
- package/dist/env/plugin/index.js +7 -7
- package/dist/env/prompt/index.js +7 -7
- package/dist/env/session/index.js +8 -7
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +7 -7
- package/dist/env/task/index.js +12 -12
- package/dist/env/task/plugins/index.js +8 -8
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/tools/index.js +3 -3
- package/dist/env/tool/built-in/index.js +2 -2
- package/dist/env/tool/index.js +8 -8
- package/dist/env/workflow/engine/index.js +10 -9
- package/dist/env/workflow/index.js +18 -17
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/service/index.js +2 -2
- package/dist/env/workflow/storage/index.js +3 -3
- package/dist/env/workflow/tools/index.js +12 -11
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +43 -42
- package/dist/shared/@ai-setting/{roy-agent-core-dabnevwe.js → roy-agent-core-1pjct4nj.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-qvaqmj3f.js → roy-agent-core-2bbj3jqd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0r90298w.js → roy-agent-core-3ajh3cdj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v5vs1jby.js → roy-agent-core-48f17g3x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hxazjj4p.js → roy-agent-core-56j2q0w6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4cj6hram.js → roy-agent-core-5hjtbvxf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4m02hnqf.js → roy-agent-core-5ja22qkf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ajtsk20z.js → roy-agent-core-5vf48m39.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-4kbvfnn1.js → roy-agent-core-8pqq9yjt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6vbgswjw.js → roy-agent-core-98wwn2px.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vsrfzaze.js → roy-agent-core-azdsyhvx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-a9pbda78.js → roy-agent-core-bt6h398s.js} +18 -3
- package/dist/shared/@ai-setting/{roy-agent-core-yjjqm4ww.js → roy-agent-core-c0mnxxck.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-y1n63tse.js → roy-agent-core-cnsjr3ws.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9qn92jhf.js → roy-agent-core-e2569ptp.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9cqpdrnk.js → roy-agent-core-e302nvzt.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ygnva439.js → roy-agent-core-ecb8am8s.js} +6 -5
- package/dist/shared/@ai-setting/{roy-agent-core-za09t5g3.js → roy-agent-core-ed4tbkyj.js} +6 -4
- package/dist/shared/@ai-setting/{roy-agent-core-wn59p0zw.js → roy-agent-core-emjpkx9s.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-1rm32m5t.js → roy-agent-core-f51kwn6m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-zbb3sk72.js → roy-agent-core-fm77q3tn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yjqj3taz.js → roy-agent-core-hqtp5m8v.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-pd0exvnq.js → roy-agent-core-j783tcqb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-amp8qckb.js → roy-agent-core-k0mx0tkh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nvcqp6p9.js → roy-agent-core-k0sy76cw.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-zrgaemma.js → roy-agent-core-kazn764f.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-54wzmvnb.js → roy-agent-core-khx0h4j2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gy1zfe0d.js → roy-agent-core-m9drr1fd.js} +76 -13
- package/dist/shared/@ai-setting/{roy-agent-core-3j4by8rj.js → roy-agent-core-mqaht7mm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-rgpkygbc.js → roy-agent-core-ncaqkyfj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p1p9mr8f.js → roy-agent-core-rqyxdrxg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7p5zf8ay.js → roy-agent-core-sea232w4.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-5j4awbgc.js → roy-agent-core-trd6my5j.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-tm57tmds.js → roy-agent-core-v2d0bt7e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bjrtwfta.js → roy-agent-core-v6zdngr7.js} +27 -11
- package/dist/shared/@ai-setting/{roy-agent-core-3b2ceffs.js → roy-agent-core-vrj9c5y6.js} +44 -76
- package/dist/shared/@ai-setting/{roy-agent-core-8nv07zgr.js → roy-agent-core-wt37tszm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-83mk8wrn.js → roy-agent-core-x8ebdrtn.js} +8 -6
- package/dist/shared/@ai-setting/{roy-agent-core-jfptxs4f.js → roy-agent-core-xmfyt3dg.js} +6 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ead21w5c.js → roy-agent-core-xn12d221.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-y1fp2mgf.js → roy-agent-core-xvf97xs4.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-55hkeft7.js → roy-agent-core-ydwtpzyf.js} +26 -6
- package/dist/shared/@ai-setting/{roy-agent-core-333apxaa.js → roy-agent-core-yes3mr8n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hkj5v9xq.js → roy-agent-core-yge38dkn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4nnv0dze.js → roy-agent-core-yq45m8mm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-d94ddn0r.js → roy-agent-core-zc9k2n3c.js} +7 -6
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +37 -0
- package/dist/shared/@ai-setting/{roy-agent-core-xyys5m1a.js → roy-agent-core-zff8vvs5.js} +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AgentComponentAdapter,
|
|
9
9
|
init_agent_component_adapter
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-xmfyt3dg.js";
|
|
11
11
|
import {
|
|
12
12
|
PythonCallNode,
|
|
13
13
|
SkillNode,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
init_skill_node,
|
|
18
18
|
init_tool_node,
|
|
19
19
|
init_workflow_node
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-c0mnxxck.js";
|
|
21
21
|
import {
|
|
22
22
|
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
23
23
|
init_json_schema_to_zod,
|
|
@@ -29,11 +29,11 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
TemplateResolver,
|
|
31
31
|
init_template_resolver
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-yes3mr8n.js";
|
|
33
33
|
import {
|
|
34
34
|
DAGManager,
|
|
35
35
|
init_dag_manager
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-v2d0bt7e.js";
|
|
37
37
|
import {
|
|
38
38
|
WorkflowError,
|
|
39
39
|
createWorkflowEvent,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
import {
|
|
50
50
|
TracedAs,
|
|
51
51
|
init_decorator
|
|
52
|
-
} from "./roy-agent-core-
|
|
52
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
53
53
|
import {
|
|
54
54
|
createLogger,
|
|
55
55
|
init_logger
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSharedEventStore
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-zff8vvs5.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskHookPoints
|
|
6
6
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -9,24 +9,24 @@ import {
|
|
|
9
9
|
} from "./roy-agent-core-223v204d.js";
|
|
10
10
|
import {
|
|
11
11
|
validateWorkflowDefinition
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-98wwn2px.js";
|
|
13
13
|
import {
|
|
14
14
|
enqueueToAddFakeUserMessage
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-5hjtbvxf.js";
|
|
16
16
|
import {
|
|
17
17
|
BasePlugin
|
|
18
18
|
} from "./roy-agent-core-az13yzmc.js";
|
|
19
19
|
import {
|
|
20
20
|
init_context
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
22
22
|
import {
|
|
23
23
|
getEnvContextOrEmpty
|
|
24
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
25
25
|
import {
|
|
26
26
|
TracedAs,
|
|
27
27
|
init_decorator,
|
|
28
28
|
wrapFunction
|
|
29
|
-
} from "./roy-agent-core-
|
|
29
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
30
30
|
import {
|
|
31
31
|
createLogger,
|
|
32
32
|
init_logger
|
|
@@ -295,11 +295,11 @@ ${prompt}`;
|
|
|
295
295
|
}
|
|
296
296
|
if (!this._workflowRepo) {
|
|
297
297
|
try {
|
|
298
|
-
const sqlite = await import("./roy-agent-core-
|
|
298
|
+
const sqlite = await import("./roy-agent-core-e302nvzt.js");
|
|
299
299
|
this.ensureDataDir();
|
|
300
300
|
const db = sqlite.getDatabase();
|
|
301
301
|
sqlite.initializeTables();
|
|
302
|
-
const { WorkflowRepository } = await import("./roy-agent-core-
|
|
302
|
+
const { WorkflowRepository } = await import("./roy-agent-core-trd6my5j.js");
|
|
303
303
|
this._workflowRepo = new WorkflowRepository(db);
|
|
304
304
|
return this._workflowRepo;
|
|
305
305
|
} catch {
|
|
@@ -20,7 +20,8 @@ function Traced(options) {
|
|
|
20
20
|
maxLogSize: options?.maxLogSize,
|
|
21
21
|
paramFilter: options?.paramFilter,
|
|
22
22
|
resultFilter: options?.resultFilter,
|
|
23
|
-
flattenParamFilter: options?.flattenParamFilter
|
|
23
|
+
flattenParamFilter: options?.flattenParamFilter,
|
|
24
|
+
errorIf: options?.errorIf
|
|
24
25
|
});
|
|
25
26
|
return function(target, propertyKey, descriptor) {
|
|
26
27
|
if (descriptor !== undefined && descriptor !== null && typeof descriptor === "object" && "value" in descriptor) {
|
|
@@ -172,7 +173,14 @@ function wrapFunction(fn, name, options) {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
span.setAttribute("result", JSON.stringify(truncate(resolved)));
|
|
175
|
-
|
|
176
|
+
const resultError = options?.errorIf ? options.errorIf(resolved) : undefined;
|
|
177
|
+
if (resultError) {
|
|
178
|
+
const err = resultError instanceof Error ? resultError : new Error(String(resultError));
|
|
179
|
+
span.setAttribute("error", err.message);
|
|
180
|
+
span.end(undefined, err);
|
|
181
|
+
} else {
|
|
182
|
+
span.end(resolved);
|
|
183
|
+
}
|
|
176
184
|
}
|
|
177
185
|
logFn("quit", options?.recordResult ? resolved : undefined, callerLocation);
|
|
178
186
|
return resolved;
|
|
@@ -195,7 +203,14 @@ function wrapFunction(fn, name, options) {
|
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
span.setAttribute("result", JSON.stringify(truncate(result)));
|
|
198
|
-
|
|
206
|
+
const syncResultError = options?.errorIf ? options.errorIf(result) : undefined;
|
|
207
|
+
if (syncResultError) {
|
|
208
|
+
const err = syncResultError instanceof Error ? syncResultError : new Error(String(syncResultError));
|
|
209
|
+
span.setAttribute("error", err.message);
|
|
210
|
+
span.end(undefined, err);
|
|
211
|
+
} else {
|
|
212
|
+
span.end(result);
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
logFn("quit", options?.recordResult ? result : undefined, callerLocation);
|
|
201
216
|
return result;
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
hasDecoratorNodes,
|
|
4
4
|
init_node_registry_helper,
|
|
5
5
|
registerDecoratorNodeType
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-yge38dkn.js";
|
|
7
7
|
import"./roy-agent-core-1ce3fqrk.js";
|
|
8
8
|
import"./roy-agent-core-ddwa0n6h.js";
|
|
9
|
-
import"./roy-agent-core-
|
|
9
|
+
import"./roy-agent-core-bt6h398s.js";
|
|
10
10
|
import"./roy-agent-core-8seq65bp.js";
|
|
11
11
|
import"./roy-agent-core-jnszp0jq.js";
|
|
12
12
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TagRepository
|
|
3
|
-
} from "./roy-agent-core-
|
|
4
|
-
import"./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-j783tcqb.js";
|
|
4
|
+
import"./roy-agent-core-bt6h398s.js";
|
|
5
5
|
import"./roy-agent-core-8seq65bp.js";
|
|
6
6
|
import"./roy-agent-core-jnszp0jq.js";
|
|
7
7
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
initDatabase,
|
|
6
6
|
initializeTables,
|
|
7
7
|
resetDatabase
|
|
8
|
-
} from "./roy-agent-core-
|
|
9
|
-
import"./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-8pqq9yjt.js";
|
|
9
|
+
import"./roy-agent-core-j783tcqb.js";
|
|
10
10
|
import"./roy-agent-core-rvxg1wps.js";
|
|
11
|
-
import"./roy-agent-core-
|
|
11
|
+
import"./roy-agent-core-bt6h398s.js";
|
|
12
12
|
import"./roy-agent-core-8seq65bp.js";
|
|
13
13
|
import"./roy-agent-core-jnszp0jq.js";
|
|
14
14
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponentAdapter,
|
|
3
3
|
init_agent_component_adapter
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-xmfyt3dg.js";
|
|
5
5
|
import"./roy-agent-core-1db4vpc6.js";
|
|
6
|
+
import"./roy-agent-core-ze068vc9.js";
|
|
6
7
|
import"./roy-agent-core-e25xkv53.js";
|
|
7
|
-
import"./roy-agent-core-
|
|
8
|
-
import"./roy-agent-core-
|
|
9
|
-
import"./roy-agent-core-
|
|
10
|
-
import"./roy-agent-core-
|
|
8
|
+
import"./roy-agent-core-mqaht7mm.js";
|
|
9
|
+
import"./roy-agent-core-emjpkx9s.js";
|
|
10
|
+
import"./roy-agent-core-fm77q3tn.js";
|
|
11
|
+
import"./roy-agent-core-bt6h398s.js";
|
|
11
12
|
import"./roy-agent-core-8seq65bp.js";
|
|
12
13
|
import"./roy-agent-core-jnszp0jq.js";
|
|
13
14
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
TracedAs,
|
|
6
6
|
init_decorator
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
@@ -111,7 +111,9 @@ class AgentRegistry {
|
|
|
111
111
|
if (agent.systemPromptRef) {
|
|
112
112
|
try {
|
|
113
113
|
if (promptComponent?.getPrompt) {
|
|
114
|
-
const rendered = await promptComponent.getPrompt(agent.systemPromptRef
|
|
114
|
+
const rendered = await promptComponent.getPrompt(agent.systemPromptRef, {}, {
|
|
115
|
+
agentType: agent.type
|
|
116
|
+
});
|
|
115
117
|
if (rendered) {
|
|
116
118
|
logger.debug(`[AgentRegistry] Resolved systemPromptRef via getPrompt: ${agent.systemPromptRef}`);
|
|
117
119
|
return rendered;
|
|
@@ -273,7 +275,7 @@ class AgentRegistry {
|
|
|
273
275
|
systemPromptRef: "compact",
|
|
274
276
|
allowedTools: ["workflow_submit_output"],
|
|
275
277
|
deniedTools: [],
|
|
276
|
-
maxIterations:
|
|
278
|
+
maxIterations: 3,
|
|
277
279
|
filterHistory: false
|
|
278
280
|
};
|
|
279
281
|
this.agents.set(name, agent);
|
|
@@ -289,7 +291,7 @@ class AgentRegistry {
|
|
|
289
291
|
systemPromptRef: "compact-hint",
|
|
290
292
|
allowedTools: ["workflow_submit_output"],
|
|
291
293
|
deniedTools: [],
|
|
292
|
-
maxIterations:
|
|
294
|
+
maxIterations: 3,
|
|
293
295
|
filterHistory: false
|
|
294
296
|
};
|
|
295
297
|
this.agents.set(name, agent);
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-az13yzmc.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
7
7
|
import {
|
|
8
8
|
globalHookManager,
|
|
9
9
|
init_global_hook_manager
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
11
11
|
import {
|
|
12
12
|
init_context
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
14
14
|
import {
|
|
15
15
|
getEnvContextOrEmpty
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
17
17
|
import {
|
|
18
18
|
createLogger,
|
|
19
19
|
init_logger
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
searchTasksTool,
|
|
10
10
|
treeTasksTool,
|
|
11
11
|
updateTaskTool
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-azdsyhvx.js";
|
|
13
13
|
import {
|
|
14
14
|
createOperationTool,
|
|
15
15
|
deleteOperationTool,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
BackgroundTaskManager,
|
|
28
28
|
createDelegateTool,
|
|
29
29
|
createStopTool
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-k0sy76cw.js";
|
|
31
31
|
import {
|
|
32
32
|
SQLiteTaskStore,
|
|
33
33
|
getDefaultTaskDbPath
|
|
34
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-rqyxdrxg.js";
|
|
35
35
|
import {
|
|
36
36
|
TaskHookPoints
|
|
37
37
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -40,19 +40,19 @@ import {
|
|
|
40
40
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
41
41
|
import {
|
|
42
42
|
BaseComponent
|
|
43
|
-
} from "./roy-agent-core-
|
|
43
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
44
44
|
import {
|
|
45
45
|
globalHookManager,
|
|
46
46
|
init_global_hook_manager
|
|
47
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
48
48
|
import {
|
|
49
49
|
getEnvContextOrEmpty,
|
|
50
50
|
init_env_context
|
|
51
|
-
} from "./roy-agent-core-
|
|
51
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
52
52
|
import {
|
|
53
53
|
TracedAs,
|
|
54
54
|
init_decorator
|
|
55
|
-
} from "./roy-agent-core-
|
|
55
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
56
56
|
import {
|
|
57
57
|
createLogger,
|
|
58
58
|
init_logger
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-tbrn9wdm.js";
|
|
5
5
|
import {
|
|
6
6
|
getSharedEventStore
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-zff8vvs5.js";
|
|
8
8
|
import {
|
|
9
9
|
TaskHookPoints
|
|
10
10
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -13,26 +13,26 @@ import {
|
|
|
13
13
|
} from "./roy-agent-core-223v204d.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_SUBAGENT_PROMPT
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-ed4tbkyj.js";
|
|
17
17
|
import {
|
|
18
18
|
runWithBgTaskIdAsync
|
|
19
19
|
} from "./roy-agent-core-c1v263jn.js";
|
|
20
20
|
import {
|
|
21
21
|
globalHookManager,
|
|
22
22
|
init_global_hook_manager
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-mqaht7mm.js";
|
|
24
24
|
import {
|
|
25
25
|
init_context
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-emjpkx9s.js";
|
|
27
27
|
import {
|
|
28
28
|
getCurrentTaskId,
|
|
29
29
|
getEnvContext
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-fm77q3tn.js";
|
|
31
31
|
import {
|
|
32
32
|
TracedAs,
|
|
33
33
|
init_decorator,
|
|
34
34
|
wrapFunction
|
|
35
|
-
} from "./roy-agent-core-
|
|
35
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
36
36
|
import {
|
|
37
37
|
createLogger,
|
|
38
38
|
init_logger
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValidSessionId
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-m9drr1fd.js";
|
|
4
4
|
import {
|
|
5
5
|
TAG_MAX_COUNT,
|
|
6
6
|
TAG_MIN_COUNT
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-wt37tszm.js";
|
|
8
8
|
import {
|
|
9
9
|
validateWorkflowDefinition
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-98wwn2px.js";
|
|
11
11
|
import {
|
|
12
12
|
getCurrentBgTaskId
|
|
13
13
|
} from "./roy-agent-core-c1v263jn.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
TracedAs,
|
|
20
20
|
init_decorator
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
22
22
|
import {
|
|
23
23
|
createLogger,
|
|
24
24
|
init_logger
|
|
@@ -2,6 +2,10 @@ import {
|
|
|
2
2
|
MemorySessionStore,
|
|
3
3
|
SQLiteSessionStore
|
|
4
4
|
} from "./roy-agent-core-h93v6p6y.js";
|
|
5
|
+
import {
|
|
6
|
+
init_loose_json,
|
|
7
|
+
tryParseJsonFromText
|
|
8
|
+
} from "./roy-agent-core-ze068vc9.js";
|
|
5
9
|
import {
|
|
6
10
|
init_search_query_parser,
|
|
7
11
|
matchesQuery,
|
|
@@ -12,11 +16,11 @@ import {
|
|
|
12
16
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
13
17
|
import {
|
|
14
18
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-xn12d221.js";
|
|
16
20
|
import {
|
|
17
21
|
TracedAs,
|
|
18
22
|
init_decorator
|
|
19
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-bt6h398s.js";
|
|
20
24
|
import {
|
|
21
25
|
createLogger,
|
|
22
26
|
init_logger
|
|
@@ -63,9 +67,50 @@ var SESSION_CONFIG_REGISTRATION = {
|
|
|
63
67
|
|
|
64
68
|
// src/env/session/session-component.ts
|
|
65
69
|
init_search_query_parser();
|
|
70
|
+
init_loose_json();
|
|
66
71
|
import path from "path";
|
|
67
72
|
import { z } from "zod";
|
|
68
73
|
var logger = createLogger("session");
|
|
74
|
+
function normalizeAgentCheckpoint(data) {
|
|
75
|
+
return {
|
|
76
|
+
title: data.title || "Untitled Checkpoint",
|
|
77
|
+
processKeyPoints: data.processKeyPoints || [],
|
|
78
|
+
currentState: data.currentState || "",
|
|
79
|
+
nextSteps: data.nextSteps || [],
|
|
80
|
+
userIntents: data.userIntents || [],
|
|
81
|
+
rawResponse: JSON.stringify(data)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var DEGRADED_TEXT_SENTINELS = new Set([
|
|
85
|
+
"[hint extraction failed]"
|
|
86
|
+
]);
|
|
87
|
+
function isUsableCheckpointText(text) {
|
|
88
|
+
const raw = (text ?? "").trim();
|
|
89
|
+
if (!raw)
|
|
90
|
+
return false;
|
|
91
|
+
return !DEGRADED_TEXT_SENTINELS.has(raw.toLowerCase());
|
|
92
|
+
}
|
|
93
|
+
function buildCheckpointFromFinalText(finalText) {
|
|
94
|
+
if (!isUsableCheckpointText(finalText))
|
|
95
|
+
return;
|
|
96
|
+
const raw = finalText.trim();
|
|
97
|
+
const parsed = tryParseJsonFromText(raw);
|
|
98
|
+
if (parsed && (parsed.title || parsed.currentState || parsed.processKeyPoints)) {
|
|
99
|
+
return normalizeAgentCheckpoint(parsed);
|
|
100
|
+
}
|
|
101
|
+
const lines = raw.split(`
|
|
102
|
+
`).map((l) => l.trim()).filter(Boolean);
|
|
103
|
+
const heading = lines.find((l) => /^#{1,6}\s+/.test(l)) ?? lines[0] ?? "";
|
|
104
|
+
const title = heading.replace(/^#{1,6}\s+/, "").replace(/^[*_`\s]+|[*_`\s]+$/g, "").slice(0, 80);
|
|
105
|
+
return {
|
|
106
|
+
title: title || "Untitled Checkpoint",
|
|
107
|
+
processKeyPoints: [],
|
|
108
|
+
currentState: raw,
|
|
109
|
+
nextSteps: [],
|
|
110
|
+
userIntents: [],
|
|
111
|
+
rawResponse: raw
|
|
112
|
+
};
|
|
113
|
+
}
|
|
69
114
|
function sleep(ms) {
|
|
70
115
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
116
|
}
|
|
@@ -598,7 +643,10 @@ class SessionComponent extends BaseComponent {
|
|
|
598
643
|
persistSession: false,
|
|
599
644
|
extraTools: [submitTool]
|
|
600
645
|
});
|
|
601
|
-
const hint = hintData?.guidance_prompt || "
|
|
646
|
+
const hint = hintData?.guidance_prompt || "";
|
|
647
|
+
if (!hint) {
|
|
648
|
+
logger.warn("[SessionComponent] Compact hint unavailable (compact-hint did not submit) — returning empty hint", { sessionId });
|
|
649
|
+
}
|
|
602
650
|
logger.info("[SessionComponent] Compact hint generated", {
|
|
603
651
|
sessionId,
|
|
604
652
|
hintLength: hint.length
|
|
@@ -646,20 +694,26 @@ class SessionComponent extends BaseComponent {
|
|
|
646
694
|
}
|
|
647
695
|
};
|
|
648
696
|
const agentComponent = this.env.getComponent("agent");
|
|
649
|
-
await agentComponent.run("compact", userQuery, {
|
|
697
|
+
const runResult = await agentComponent.run("compact", userQuery, {
|
|
650
698
|
sessionId,
|
|
651
699
|
persistSession: false,
|
|
652
700
|
extraTools: [submitTool]
|
|
653
701
|
});
|
|
654
|
-
const data = checkpointData
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
702
|
+
const data = checkpointData;
|
|
703
|
+
if (data) {
|
|
704
|
+
summaryResult = normalizeAgentCheckpoint(data);
|
|
705
|
+
} else {
|
|
706
|
+
const fallback = buildCheckpointFromFinalText(runResult?.finalText) ?? buildCheckpointFromFinalText(options?.scenarioHint);
|
|
707
|
+
if (!fallback) {
|
|
708
|
+
throw new Error(`compact agent returned no usable checkpoint output ` + `(no workflow_submit_output call, no usable finalText or scenarioHint); ` + `refusing to archive ${messages.length} messages for session ${sessionId}`);
|
|
709
|
+
}
|
|
710
|
+
if (runResult?.finalText?.trim()) {
|
|
711
|
+
logger.warn(`[SessionComponent] compact agent did not call workflow_submit_output; ` + `falling back to its finalText for the checkpoint (session=${sessionId}, ` + `finalTextLength=${runResult.finalText.length})`);
|
|
712
|
+
} else {
|
|
713
|
+
logger.warn(`[SessionComponent] compact agent produced neither a tool call nor text; ` + `falling back to scenarioHint for the checkpoint (session=${sessionId})`);
|
|
714
|
+
}
|
|
715
|
+
summaryResult = fallback;
|
|
716
|
+
}
|
|
663
717
|
} catch (error) {
|
|
664
718
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
665
719
|
logger.error(`[SessionComponent] Compact agent failed: ${errorMessage}`);
|
|
@@ -744,6 +798,15 @@ class SessionComponent extends BaseComponent {
|
|
|
744
798
|
i--;
|
|
745
799
|
}
|
|
746
800
|
}
|
|
801
|
+
if (recentMessages.length === 0) {
|
|
802
|
+
const FALLBACK_MESSAGE_LIMIT = 6;
|
|
803
|
+
const tail = messages.filter((m) => !m.metadata?.isCheckpoint).slice(-FALLBACK_MESSAGE_LIMIT).filter((m) => typeof m.content === "string" && m.content.trim()).map((m) => ({ role: m.role, content: m.content }));
|
|
804
|
+
logger.debug("[SessionComponent] extractRecentMessages fell back to raw tail", {
|
|
805
|
+
turnCount,
|
|
806
|
+
fallbackMessages: tail.length
|
|
807
|
+
});
|
|
808
|
+
return tail;
|
|
809
|
+
}
|
|
747
810
|
logger.debug("[SessionComponent] Extracted recent messages", {
|
|
748
811
|
turnCount,
|
|
749
812
|
messagesExtracted: recentMessages.length
|