@ai-setting/roy-agent-core 1.5.44 → 1.5.46
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 +5 -5
- package/dist/env/agent/index.js +6 -6
- package/dist/env/commands/index.js +5 -5
- package/dist/env/context/index.js +4 -1
- package/dist/env/debug/index.js +5 -5
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/hook/index.js +3 -3
- package/dist/env/index.js +24 -20
- package/dist/env/llm/index.js +5 -5
- package/dist/env/log-trace/index.js +5 -5
- package/dist/env/mcp/index.js +22 -6
- package/dist/env/mcp/npm-prefix/index.js +21 -0
- package/dist/env/memory/index.js +9 -9
- package/dist/env/plugin/index.js +5 -5
- package/dist/env/prompt/index.js +5 -5
- package/dist/env/session/index.js +11 -11
- package/dist/env/session/storage/index.js +1 -1
- package/dist/env/skill/index.js +5 -5
- package/dist/env/task/delegate/index.js +3 -3
- package/dist/env/task/index.js +9 -9
- package/dist/env/task/plugins/index.js +2 -2
- package/dist/env/tool/index.js +5 -5
- package/dist/env/workflow/engine/index.js +8 -3
- package/dist/env/workflow/index.js +24 -21
- package/dist/env/workflow/tools/index.js +14 -0
- package/dist/index.js +42 -38
- package/dist/shared/@ai-setting/{roy-agent-core-kajktp3d.js → roy-agent-core-20fm423j.js} +47 -26
- package/dist/shared/@ai-setting/{roy-agent-core-23gw9c4s.js → roy-agent-core-2vhsccvz.js} +52 -10
- package/dist/shared/@ai-setting/{roy-agent-core-r6rwsr54.js → roy-agent-core-3t82jyqb.js} +32 -12
- package/dist/shared/@ai-setting/{roy-agent-core-69jskqjg.js → roy-agent-core-44g4dhzg.js} +75 -7
- package/dist/shared/@ai-setting/{roy-agent-core-e9fdm13a.js → roy-agent-core-4gmxjdhn.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-b4wd9tn6.js → roy-agent-core-4k9a823d.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-68qy97r3.js +31 -0
- package/dist/shared/@ai-setting/roy-agent-core-6atd905e.js +42 -0
- package/dist/shared/@ai-setting/{roy-agent-core-4jqq077c.js → roy-agent-core-6e3wz81d.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-pwkk12p4.js → roy-agent-core-6mcb7nqa.js} +60 -0
- package/dist/shared/@ai-setting/{roy-agent-core-1zq3p19q.js → roy-agent-core-6z063hns.js} +11 -7
- package/dist/shared/@ai-setting/{roy-agent-core-9p43ap7h.js → roy-agent-core-8y804aat.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-z1xf2fdk.js → roy-agent-core-a67e90d1.js} +6 -4
- package/dist/shared/@ai-setting/{roy-agent-core-38dkek2y.js → roy-agent-core-btvxttqf.js} +329 -118
- package/dist/shared/@ai-setting/roy-agent-core-dbxm76wf.js +190 -0
- package/dist/shared/@ai-setting/{roy-agent-core-nj8yerg9.js → roy-agent-core-eftqdsy5.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-fnv3ev18.js +61 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2ms7296b.js → roy-agent-core-frjr619w.js} +12 -5
- package/dist/shared/@ai-setting/{roy-agent-core-psvwzdhj.js → roy-agent-core-hdszq729.js} +9 -5
- package/dist/shared/@ai-setting/{roy-agent-core-dxbsc1zy.js → roy-agent-core-ja9qhg6d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-cevpwnq7.js → roy-agent-core-mjbfgqen.js} +5 -3
- package/dist/shared/@ai-setting/roy-agent-core-nhfy3p8q.js +132 -0
- package/dist/shared/@ai-setting/{roy-agent-core-xkb264a8.js → roy-agent-core-pm73be85.js} +132 -24
- package/dist/shared/@ai-setting/{roy-agent-core-zrja5v78.js → roy-agent-core-pyv1vb7v.js} +13 -5
- package/dist/shared/@ai-setting/{roy-agent-core-ee6nnnqw.js → roy-agent-core-r9hq4cjx.js} +8 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jqy2mdyq.js → roy-agent-core-rgj6hq15.js} +52 -41
- package/dist/shared/@ai-setting/{roy-agent-core-z33en0cz.js → roy-agent-core-rm3hay00.js} +15 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ryw3ckfy.js → roy-agent-core-rx74rye7.js} +5 -3
- package/dist/shared/@ai-setting/{roy-agent-core-pxcrzyv9.js → roy-agent-core-sk535ft2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2dhd60aw.js → roy-agent-core-vdwvamre.js} +10 -0
- package/dist/shared/@ai-setting/roy-agent-core-ye0z728h.js +18 -0
- package/dist/shared/@ai-setting/{roy-agent-core-eg6nv09z.js → roy-agent-core-ztx5eh72.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nqgrjja0.js → roy-agent-core-zwq6vhpj.js} +1 -1
- package/package.json +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
ContextError
|
|
10
10
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
11
|
+
import {
|
|
12
|
+
SessionMessageConverter
|
|
13
|
+
} from "./roy-agent-core-7b35emr7.js";
|
|
11
14
|
import {
|
|
12
15
|
TracedAs,
|
|
13
16
|
init_decorator
|
|
@@ -17,20 +20,19 @@ import {
|
|
|
17
20
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
18
21
|
import {
|
|
19
22
|
BaseComponent
|
|
20
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-6e3wz81d.js";
|
|
21
24
|
import {
|
|
22
|
-
globalHookManager
|
|
23
|
-
|
|
25
|
+
globalHookManager,
|
|
26
|
+
init_global_hook_manager
|
|
27
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
24
28
|
import {
|
|
29
|
+
init_context,
|
|
25
30
|
runWithEnvContextAsync
|
|
26
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-rm3hay00.js";
|
|
27
32
|
import {
|
|
28
33
|
createLogger,
|
|
29
34
|
init_logger
|
|
30
35
|
} from "./roy-agent-core-10n2jh7p.js";
|
|
31
|
-
import {
|
|
32
|
-
SessionMessageConverter
|
|
33
|
-
} from "./roy-agent-core-7b35emr7.js";
|
|
34
36
|
import {
|
|
35
37
|
__legacyDecorateClassTS
|
|
36
38
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -67,6 +69,8 @@ var AGENT_CONFIG_REGISTRATION = {
|
|
|
67
69
|
|
|
68
70
|
// src/env/agent/agent-component.ts
|
|
69
71
|
init_decorator();
|
|
72
|
+
init_global_hook_manager();
|
|
73
|
+
init_context();
|
|
70
74
|
init_workflow_hil();
|
|
71
75
|
var logger = createLogger("agent:component");
|
|
72
76
|
function toLLMMessage(msg) {
|
|
@@ -579,10 +583,12 @@ class AgentComponent extends BaseComponent {
|
|
|
579
583
|
model: effectiveContext.model
|
|
580
584
|
}
|
|
581
585
|
});
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
+
if (query) {
|
|
587
|
+
this.pushMessage(hookCtx, {
|
|
588
|
+
role: "user",
|
|
589
|
+
content: query
|
|
590
|
+
});
|
|
591
|
+
}
|
|
586
592
|
await this.executePluginHooks(agent, "agent:before.start", hookCtx);
|
|
587
593
|
if (hookCtx._stopped) {
|
|
588
594
|
return this.finalizeResult(result, hookCtx);
|
|
@@ -877,6 +883,7 @@ class AgentComponent extends BaseComponent {
|
|
|
877
883
|
if (iteration >= agent.config.maxIterations && !result.finalText) {
|
|
878
884
|
result.finalText = "Maximum iterations reached.";
|
|
879
885
|
}
|
|
886
|
+
const newMessages = hookCtx.messages.slice(historyMessageCount);
|
|
880
887
|
const reactContext = {
|
|
881
888
|
messages: hookCtx.messages,
|
|
882
889
|
sessionId: effectiveContext.sessionId,
|
|
@@ -886,6 +893,9 @@ class AgentComponent extends BaseComponent {
|
|
|
886
893
|
...hookCtx,
|
|
887
894
|
...reactContext
|
|
888
895
|
});
|
|
896
|
+
if (hookCtx.structuredOutputExtracted) {
|
|
897
|
+
result.structuredOutput = hookCtx.structuredOutputExtracted;
|
|
898
|
+
}
|
|
889
899
|
await this.executePluginHooks(agent, "agent:after.complete", hookCtx);
|
|
890
900
|
if (this.aborted.get(runId) === true || hookCtx._stopped) {
|
|
891
901
|
agent.status = "stopped";
|
|
@@ -913,7 +923,6 @@ class AgentComponent extends BaseComponent {
|
|
|
913
923
|
}
|
|
914
924
|
});
|
|
915
925
|
}
|
|
916
|
-
let newMessages = hookCtx.messages.slice(historyMessageCount);
|
|
917
926
|
logger.info(`Agent run completed: ${agentName}`, {
|
|
918
927
|
iterations: result.iterations,
|
|
919
928
|
hasError: !!result.error,
|
|
@@ -1030,6 +1039,14 @@ ${ctx.context.additionInfo}`
|
|
|
1030
1039
|
};
|
|
1031
1040
|
}
|
|
1032
1041
|
try {
|
|
1042
|
+
this.pushEnvEvent({
|
|
1043
|
+
type: "tool.call",
|
|
1044
|
+
payload: {
|
|
1045
|
+
id: toolCall.id,
|
|
1046
|
+
name: toolName,
|
|
1047
|
+
arguments: toolCall.arguments
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1033
1050
|
const toolContext = {
|
|
1034
1051
|
session_id: ctx.context.sessionId,
|
|
1035
1052
|
message_id: ctx.context.messageId,
|
|
@@ -1169,6 +1186,9 @@ ${ctx.context.additionInfo}`
|
|
|
1169
1186
|
if (msg.role === "system") {
|
|
1170
1187
|
continue;
|
|
1171
1188
|
}
|
|
1189
|
+
if (msg.role === "user" && this.isEmptyMessage(msg.content)) {
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1172
1192
|
if (msg.role === "assistant" || msg.role === "tool") {
|
|
1173
1193
|
if (this.isEmptyMessage(msg.content)) {
|
|
1174
1194
|
continue;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY,
|
|
3
|
+
extractStructuredJsonViaLlm,
|
|
4
|
+
init_workflow_json_output_plugin,
|
|
5
|
+
registerWorkflowJsonOutputPlugin
|
|
6
|
+
} from "./roy-agent-core-dbxm76wf.js";
|
|
1
7
|
import {
|
|
2
8
|
AskUserError,
|
|
3
9
|
init_workflow_hil
|
|
@@ -11,14 +17,29 @@ class AgentComponentAdapter {
|
|
|
11
17
|
agentComponent;
|
|
12
18
|
options;
|
|
13
19
|
_sessionComponent;
|
|
20
|
+
_llmComponent;
|
|
14
21
|
agentSessionPrefix = "agent";
|
|
15
22
|
_currentAgentSessionId;
|
|
16
23
|
pendingSessions = new Map;
|
|
17
24
|
runSessionToAgentSessions = new Map;
|
|
18
|
-
|
|
25
|
+
jsonOutputPluginRegistered = false;
|
|
26
|
+
constructor(agentComponent, options = {}, _sessionComponent, _llmComponent) {
|
|
19
27
|
this.agentComponent = agentComponent;
|
|
20
28
|
this.options = options;
|
|
21
29
|
this._sessionComponent = _sessionComponent;
|
|
30
|
+
this._llmComponent = _llmComponent;
|
|
31
|
+
this.ensureJsonOutputPluginRegistered();
|
|
32
|
+
}
|
|
33
|
+
setLLMComponent(llmComponent) {
|
|
34
|
+
this._llmComponent = llmComponent;
|
|
35
|
+
this.ensureJsonOutputPluginRegistered();
|
|
36
|
+
}
|
|
37
|
+
ensureJsonOutputPluginRegistered() {
|
|
38
|
+
if (this.jsonOutputPluginRegistered || !this._llmComponent) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
registerWorkflowJsonOutputPlugin(this._llmComponent);
|
|
42
|
+
this.jsonOutputPluginRegistered = true;
|
|
22
43
|
}
|
|
23
44
|
setSessionComponent(sessionComponent) {
|
|
24
45
|
this._sessionComponent = sessionComponent;
|
|
@@ -84,6 +105,7 @@ class AgentComponentAdapter {
|
|
|
84
105
|
}
|
|
85
106
|
}
|
|
86
107
|
try {
|
|
108
|
+
const outputSchema = config.options?.outputSchema;
|
|
87
109
|
const context = {};
|
|
88
110
|
if (config.options?.timeout) {
|
|
89
111
|
context.abort = new AbortController;
|
|
@@ -97,11 +119,33 @@ class AgentComponentAdapter {
|
|
|
97
119
|
if (config.options?.deniedTools) {
|
|
98
120
|
context.deniedTools = config.options.deniedTools;
|
|
99
121
|
}
|
|
122
|
+
context.metadata = {
|
|
123
|
+
runId,
|
|
124
|
+
nodeId,
|
|
125
|
+
sessionId: agentSessionId,
|
|
126
|
+
outputSchema
|
|
127
|
+
};
|
|
128
|
+
if (outputSchema) {
|
|
129
|
+
context.pluginEnabled = {
|
|
130
|
+
...context.pluginEnabled ?? {},
|
|
131
|
+
[WORKFLOW_JSON_OUTPUT_PLUGIN_KEY]: true
|
|
132
|
+
};
|
|
133
|
+
}
|
|
100
134
|
if (config.workflowHistory) {
|
|
101
135
|
context.workflowHistory = config.workflowHistory;
|
|
102
136
|
}
|
|
103
|
-
|
|
104
|
-
|
|
137
|
+
let additionInfo = config.prompt;
|
|
138
|
+
let userInput = resumeOptions?.userQuery || "";
|
|
139
|
+
if (agentSessionId && this._sessionComponent && !isResume) {
|
|
140
|
+
try {
|
|
141
|
+
const priorMessages = await this._sessionComponent.getMessages(agentSessionId);
|
|
142
|
+
const hasPriorAssistant = priorMessages.some((m) => m.role === "assistant" && (Boolean(m.content?.trim()) || m.parts?.some((p) => p.type === "tool-call" || p.type === "text")));
|
|
143
|
+
if (hasPriorAssistant && !userInput) {
|
|
144
|
+
userInput = "[Workflow re-run] Inputs were updated since your last reply. Produce a new result for this run.";
|
|
145
|
+
}
|
|
146
|
+
} catch {}
|
|
147
|
+
}
|
|
148
|
+
context.additionInfo = additionInfo;
|
|
105
149
|
const result = await this.agentComponent.run(config.type || "general", userInput, context);
|
|
106
150
|
if (result.error?.startsWith("__ASK_USER_ERROR__:")) {
|
|
107
151
|
const jsonStr = result.error.substring("__ASK_USER_ERROR__:".length);
|
|
@@ -112,16 +156,17 @@ class AgentComponentAdapter {
|
|
|
112
156
|
if (agentSessionId) {
|
|
113
157
|
this.pendingSessions.delete(agentSessionId);
|
|
114
158
|
}
|
|
115
|
-
const
|
|
159
|
+
const structuredOutput = await this.resolveStructuredOutput(result.structuredOutput, outputSchema, config, agentSessionId);
|
|
116
160
|
return {
|
|
117
|
-
output: result.finalText
|
|
161
|
+
output: structuredOutput ?? result.finalText ?? result.output,
|
|
162
|
+
structuredOutput,
|
|
118
163
|
metadata: {
|
|
119
164
|
duration,
|
|
120
165
|
iterations: result.iterations,
|
|
121
166
|
toolCalls: result.toolCalls?.length,
|
|
167
|
+
toolCallsDetail: result.toolCalls,
|
|
122
168
|
agentSessionId
|
|
123
|
-
}
|
|
124
|
-
messages
|
|
169
|
+
}
|
|
125
170
|
};
|
|
126
171
|
} catch (error) {
|
|
127
172
|
const isAskUserError = error instanceof Error && error.name === "AskUserError";
|
|
@@ -171,10 +216,33 @@ class AgentComponentAdapter {
|
|
|
171
216
|
getAgentComponent() {
|
|
172
217
|
return this.agentComponent;
|
|
173
218
|
}
|
|
219
|
+
async resolveStructuredOutput(fromPlugin, outputSchema, config, agentSessionId) {
|
|
220
|
+
if (fromPlugin) {
|
|
221
|
+
return fromPlugin;
|
|
222
|
+
}
|
|
223
|
+
if (!outputSchema || !this._llmComponent || !agentSessionId || !this._sessionComponent) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const sessionMessages = await this._sessionComponent.getMessages(agentSessionId);
|
|
228
|
+
const history = sessionMessages.map((m) => ({
|
|
229
|
+
role: m.role,
|
|
230
|
+
content: m.content ?? ""
|
|
231
|
+
}));
|
|
232
|
+
return await extractStructuredJsonViaLlm(this._llmComponent, history, outputSchema, {
|
|
233
|
+
model: config.options?.model,
|
|
234
|
+
sessionId: agentSessionId
|
|
235
|
+
});
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.warn("Workflow JSON extraction fallback failed:", error);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
174
241
|
agentSessionPrefixes = new Map;
|
|
175
242
|
}
|
|
176
243
|
var init_agent_component_adapter = __esm(() => {
|
|
177
244
|
init_workflow_hil();
|
|
245
|
+
init_workflow_json_output_plugin();
|
|
178
246
|
});
|
|
179
247
|
|
|
180
248
|
export { AgentComponentAdapter, init_agent_component_adapter };
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
init_decorator
|
|
10
10
|
} from "./roy-agent-core-q5qj0fes.js";
|
|
11
11
|
import {
|
|
12
|
-
getEnvContextOrEmpty
|
|
13
|
-
|
|
12
|
+
getEnvContextOrEmpty,
|
|
13
|
+
init_context
|
|
14
|
+
} from "./roy-agent-core-rm3hay00.js";
|
|
14
15
|
import {
|
|
15
16
|
createLogger,
|
|
16
17
|
init_logger
|
|
@@ -387,6 +388,7 @@ ${prompt}`;
|
|
|
387
388
|
// src/env/task/plugins/lark-cli-task-notify-plugin.ts
|
|
388
389
|
init_decorator();
|
|
389
390
|
init_logger();
|
|
391
|
+
init_context();
|
|
390
392
|
import { spawn } from "child_process";
|
|
391
393
|
var logger2 = createLogger("lark-cli:task-notify");
|
|
392
394
|
function isTaskNotifyDebugEnabled() {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY,
|
|
3
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_NAME,
|
|
4
|
+
WORKFLOW_JSON_OUTPUT_SOURCE_ID,
|
|
5
|
+
extractStructuredJsonViaLlm,
|
|
6
|
+
init_workflow_json_output_plugin,
|
|
7
|
+
isWorkflowJsonOutputEnabled,
|
|
8
|
+
registerWorkflowJsonOutputPlugin,
|
|
9
|
+
runWorkflowJsonOutputExtraction,
|
|
10
|
+
unregisterWorkflowJsonOutputPlugin
|
|
11
|
+
} from "./roy-agent-core-dbxm76wf.js";
|
|
12
|
+
import"./roy-agent-core-nhfy3p8q.js";
|
|
13
|
+
import"./roy-agent-core-e25xkv53.js";
|
|
14
|
+
import"./roy-agent-core-rgj6hq15.js";
|
|
15
|
+
import"./roy-agent-core-rm3hay00.js";
|
|
16
|
+
import"./roy-agent-core-10n2jh7p.js";
|
|
17
|
+
import"./roy-agent-core-58k274fg.js";
|
|
18
|
+
import"./roy-agent-core-c6592r3c.js";
|
|
19
|
+
import"./roy-agent-core-fs0mn2jk.js";
|
|
20
|
+
init_workflow_json_output_plugin();
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
unregisterWorkflowJsonOutputPlugin,
|
|
24
|
+
runWorkflowJsonOutputExtraction,
|
|
25
|
+
registerWorkflowJsonOutputPlugin,
|
|
26
|
+
isWorkflowJsonOutputEnabled,
|
|
27
|
+
extractStructuredJsonViaLlm,
|
|
28
|
+
WORKFLOW_JSON_OUTPUT_SOURCE_ID,
|
|
29
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_NAME,
|
|
30
|
+
WORKFLOW_JSON_OUTPUT_PLUGIN_KEY
|
|
31
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
4
|
+
|
|
5
|
+
// src/env/workflow/utils/workflow-message-metadata.ts
|
|
6
|
+
function getWorkflowNodeIdFromMetadata(metadata) {
|
|
7
|
+
if (!metadata) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const nodeId = metadata.nodeId;
|
|
11
|
+
const workflowNodeId = metadata.workflowNodeId;
|
|
12
|
+
return nodeId ?? workflowNodeId;
|
|
13
|
+
}
|
|
14
|
+
function buildWorkflowNodeMetadata(type, nodeId, nodeType, extra) {
|
|
15
|
+
return {
|
|
16
|
+
_workflowNodeMetadata: true,
|
|
17
|
+
type,
|
|
18
|
+
nodeId,
|
|
19
|
+
workflowNodeId: nodeId,
|
|
20
|
+
workflowNodeType: nodeType,
|
|
21
|
+
...extra
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function patchAgentSessionIdOnMessage(metadata, parts, agentSessionId) {
|
|
25
|
+
const nextMetadata = {
|
|
26
|
+
...metadata ?? {},
|
|
27
|
+
agentSessionId
|
|
28
|
+
};
|
|
29
|
+
if (!parts?.length) {
|
|
30
|
+
return { metadata: nextMetadata, parts };
|
|
31
|
+
}
|
|
32
|
+
const nextParts = parts.map((part) => {
|
|
33
|
+
if (part && typeof part === "object" && "nodeId" in part) {
|
|
34
|
+
return { ...part, agentSessionId };
|
|
35
|
+
}
|
|
36
|
+
return part;
|
|
37
|
+
});
|
|
38
|
+
return { metadata: nextMetadata, parts: nextParts };
|
|
39
|
+
}
|
|
40
|
+
var init_workflow_message_metadata = () => {};
|
|
41
|
+
|
|
42
|
+
export { getWorkflowNodeIdFromMetadata, buildWorkflowNodeMetadata, patchAgentSessionIdOnMessage, init_workflow_message_metadata };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-vdwvamre.js";
|
|
4
4
|
import {
|
|
5
5
|
HookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
7
7
|
|
|
8
8
|
// src/env/component.ts
|
|
9
9
|
class BaseComponent {
|
|
@@ -138,6 +138,28 @@ class MemorySessionStore {
|
|
|
138
138
|
session.updatedAt = Date.now();
|
|
139
139
|
return msg.id;
|
|
140
140
|
}
|
|
141
|
+
async updateMessage(sessionId, messageId, updates) {
|
|
142
|
+
const sessionMessages = this.messages.get(sessionId);
|
|
143
|
+
if (!sessionMessages) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const index = sessionMessages.findIndex((m) => m.id === messageId);
|
|
147
|
+
if (index < 0) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const current = sessionMessages[index];
|
|
151
|
+
sessionMessages[index] = {
|
|
152
|
+
...current,
|
|
153
|
+
...updates.content !== undefined ? { content: updates.content } : {},
|
|
154
|
+
...updates.metadata !== undefined ? { metadata: updates.metadata } : {},
|
|
155
|
+
...updates.parts !== undefined ? { parts: updates.parts } : {}
|
|
156
|
+
};
|
|
157
|
+
const session = this.sessions.get(sessionId);
|
|
158
|
+
if (session) {
|
|
159
|
+
session.updatedAt = Date.now();
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
141
163
|
async getMessages(sessionId, offset = 0, limit = 50, options) {
|
|
142
164
|
let messages = this.messages.get(sessionId) ?? [];
|
|
143
165
|
if (!options?.includeArchived) {
|
|
@@ -589,6 +611,44 @@ class SQLiteSessionStore {
|
|
|
589
611
|
this.sessionsCache.set(sessionId, session);
|
|
590
612
|
return msg.id;
|
|
591
613
|
}
|
|
614
|
+
async updateMessage(sessionId, messageId, updates) {
|
|
615
|
+
await this.initialize();
|
|
616
|
+
const row = this.db.prepare("SELECT id FROM message WHERE id = ? AND session_id = ?").get(messageId, sessionId);
|
|
617
|
+
if (!row) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
const sets = [];
|
|
621
|
+
const values = [];
|
|
622
|
+
if (updates.content !== undefined) {
|
|
623
|
+
sets.push("content = ?");
|
|
624
|
+
values.push(updates.content);
|
|
625
|
+
}
|
|
626
|
+
if (updates.parts !== undefined) {
|
|
627
|
+
sets.push("parts = ?");
|
|
628
|
+
values.push(JSON.stringify(updates.parts));
|
|
629
|
+
}
|
|
630
|
+
if (updates.metadata !== undefined) {
|
|
631
|
+
sets.push("metadata = ?");
|
|
632
|
+
values.push(JSON.stringify(updates.metadata));
|
|
633
|
+
}
|
|
634
|
+
if (sets.length === 0) {
|
|
635
|
+
return true;
|
|
636
|
+
}
|
|
637
|
+
values.push(messageId, sessionId);
|
|
638
|
+
this.db.prepare(`UPDATE message SET ${sets.join(", ")} WHERE id = ? AND session_id = ?`).run(...values);
|
|
639
|
+
const messages = this.messagesCache.get(sessionId) ?? [];
|
|
640
|
+
const index = messages.findIndex((m) => m.id === messageId);
|
|
641
|
+
if (index >= 0) {
|
|
642
|
+
messages[index] = {
|
|
643
|
+
...messages[index],
|
|
644
|
+
...updates.content !== undefined ? { content: updates.content } : {},
|
|
645
|
+
...updates.metadata !== undefined ? { metadata: updates.metadata } : {},
|
|
646
|
+
...updates.parts !== undefined ? { parts: updates.parts } : {}
|
|
647
|
+
};
|
|
648
|
+
this.messagesCache.set(sessionId, messages);
|
|
649
|
+
}
|
|
650
|
+
return true;
|
|
651
|
+
}
|
|
592
652
|
async getMessages(sessionId, offset = 0, limit = 50, options) {
|
|
593
653
|
await this.initialize();
|
|
594
654
|
let sql = "SELECT * FROM message WHERE session_id = ?";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TaskEntityEventTypes
|
|
3
|
+
} from "./roy-agent-core-8gxth0eh.js";
|
|
1
4
|
import {
|
|
2
5
|
BackgroundTaskManager,
|
|
3
6
|
createDelegateTool,
|
|
4
7
|
createStopTool
|
|
5
|
-
} from "./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-8y804aat.js";
|
|
6
9
|
import {
|
|
7
10
|
SQLiteTaskStore,
|
|
8
11
|
getDefaultTaskDbPath
|
|
@@ -25,9 +28,6 @@ import {
|
|
|
25
28
|
import {
|
|
26
29
|
TaskHookPoints
|
|
27
30
|
} from "./roy-agent-core-92z6t4he.js";
|
|
28
|
-
import {
|
|
29
|
-
TaskEntityEventTypes
|
|
30
|
-
} from "./roy-agent-core-8gxth0eh.js";
|
|
31
31
|
import {
|
|
32
32
|
TracedAs,
|
|
33
33
|
init_decorator
|
|
@@ -37,10 +37,11 @@ import {
|
|
|
37
37
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
38
38
|
import {
|
|
39
39
|
BaseComponent
|
|
40
|
-
} from "./roy-agent-core-
|
|
40
|
+
} from "./roy-agent-core-6e3wz81d.js";
|
|
41
41
|
import {
|
|
42
|
-
globalHookManager
|
|
43
|
-
|
|
42
|
+
globalHookManager,
|
|
43
|
+
init_global_hook_manager
|
|
44
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
44
45
|
import {
|
|
45
46
|
createLogger,
|
|
46
47
|
init_logger
|
|
@@ -68,6 +69,9 @@ var TASK_CONFIG_REGISTRATION = {
|
|
|
68
69
|
]
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
// src/env/task/task-component.ts
|
|
73
|
+
init_global_hook_manager();
|
|
74
|
+
|
|
71
75
|
// src/env/task/tag-service.ts
|
|
72
76
|
init_logger();
|
|
73
77
|
var logger = createLogger("task:tag");
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
TaskHookPoints
|
|
6
6
|
} from "./roy-agent-core-92z6t4he.js";
|
|
7
7
|
import {
|
|
8
|
-
globalHookManager
|
|
9
|
-
|
|
8
|
+
globalHookManager,
|
|
9
|
+
init_global_hook_manager
|
|
10
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
10
11
|
import {
|
|
11
12
|
createLogger,
|
|
12
13
|
init_logger
|
|
@@ -73,6 +74,7 @@ function listKnownSubagentDescriptions(registry) {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
// src/env/task/delegate/delegate-tool.ts
|
|
77
|
+
init_global_hook_manager();
|
|
76
78
|
var logger = createLogger("task:delegate");
|
|
77
79
|
var BackgroundTaskEventTypes = {
|
|
78
80
|
STARTED: "task.background.started",
|
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
} from "./roy-agent-core-qxhq8ven.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseComponent
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-6e3wz81d.js";
|
|
11
11
|
import {
|
|
12
12
|
createHook
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-vdwvamre.js";
|
|
14
14
|
import {
|
|
15
|
-
globalHookManager
|
|
16
|
-
|
|
15
|
+
globalHookManager,
|
|
16
|
+
init_global_hook_manager
|
|
17
|
+
} from "./roy-agent-core-rgj6hq15.js";
|
|
17
18
|
import {
|
|
18
19
|
createLogger,
|
|
19
20
|
init_logger
|
|
@@ -692,6 +693,7 @@ var PROMPT_CONFIG_REGISTRATION = {
|
|
|
692
693
|
};
|
|
693
694
|
|
|
694
695
|
// src/env/prompt/prompt-component.ts
|
|
696
|
+
init_global_hook_manager();
|
|
695
697
|
var logger2 = createLogger("prompt");
|
|
696
698
|
|
|
697
699
|
class PromptComponent extends BaseComponent {
|