@ai-setting/roy-agent-core 1.6.13 → 1.6.15
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 +10 -10
- package/dist/env/agent/index.js +16 -16
- package/dist/env/commands/index.js +10 -10
- package/dist/env/context/index.js +27 -7
- package/dist/env/debug/index.js +10 -10
- package/dist/env/event-source/index.js +18 -14
- package/dist/env/hook/index.js +8 -8
- package/dist/env/index.js +41 -41
- package/dist/env/llm/index.js +12 -12
- package/dist/env/log-trace/index.js +10 -10
- package/dist/env/mcp/index.js +11 -11
- package/dist/env/mcp/tool/index.js +4 -4
- package/dist/env/memory/index.js +11 -11
- package/dist/env/memory/plugin/index.js +4 -4
- package/dist/env/plugin/index.js +10 -10
- package/dist/env/prompt/index.js +10 -10
- package/dist/env/session/index.js +13 -13
- package/dist/env/session/storage/index.js +6 -6
- package/dist/env/skill/index.js +10 -10
- package/dist/env/task/delegate/index.js +10 -10
- package/dist/env/task/index.js +15 -15
- package/dist/env/task/plugins/index.js +11 -9
- package/dist/env/task/storage/index.js +5 -5
- package/dist/env/task/tools/index.js +6 -6
- package/dist/env/tool/built-in/index.js +6 -6
- package/dist/env/tool/index.js +13 -13
- package/dist/env/workflow/engine/index.js +13 -13
- package/dist/env/workflow/index.js +27 -25
- package/dist/env/workflow/nodes/index.js +5 -5
- package/dist/env/workflow/service/index.js +5 -5
- package/dist/env/workflow/storage/index.js +6 -6
- package/dist/env/workflow/tools/index.js +18 -17
- package/dist/env/workflow/types/index.js +3 -1
- package/dist/env/workflow/utils/index.js +8 -8
- package/dist/index.js +54 -52
- package/dist/shared/@ai-setting/{roy-agent-core-r74v00c7.js → roy-agent-core-02aw62bv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6qbyfzsw.js → roy-agent-core-0rwymn7m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-wpw37qqf.js → roy-agent-core-1380b0re.js} +29 -8
- package/dist/shared/@ai-setting/{roy-agent-core-deqpzcg7.js → roy-agent-core-1ecgh5ya.js} +81 -13
- package/dist/shared/@ai-setting/{roy-agent-core-wjve1qr5.js → roy-agent-core-1mrc9a1r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xxgazz27.js → roy-agent-core-1qjgwjjs.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-rga3f0hm.js → roy-agent-core-2b0mw2h3.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ck0m8754.js → roy-agent-core-416rpxkp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-c6592r3c.js → roy-agent-core-4an1p9a1.js} +31 -2
- package/dist/shared/@ai-setting/{roy-agent-core-8cbsjkkx.js → roy-agent-core-4z7dzcgb.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-txsswwhm.js → roy-agent-core-5pzegp1x.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-htjag2nr.js → roy-agent-core-77wfej1h.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-resnbd2j.js → roy-agent-core-7kw06e4b.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yfhgxh5a.js → roy-agent-core-7r72622v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dcd1s7ct.js → roy-agent-core-8n0e62y4.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fdm579b1.js → roy-agent-core-96mj6gvc.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fwxqevpf.js → roy-agent-core-9jsfqc1m.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-1mq9erp8.js → roy-agent-core-ajp566yv.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-j62bjagf.js → roy-agent-core-akb8mb9v.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5h49ct1a.js → roy-agent-core-ataagh3a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-606z25nw.js → roy-agent-core-atpchjdz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9nhwdq9r.js → roy-agent-core-b8wn8yhk.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-vcjq65nz.js → roy-agent-core-bq1gskrf.js} +23 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nw39k111.js → roy-agent-core-bqe4c9f2.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-1gsnq4p2.js → roy-agent-core-dh9rajdh.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-dtkbj8fk.js +206 -0
- package/dist/shared/@ai-setting/{roy-agent-core-8x4ngxcy.js → roy-agent-core-e0kaxcy1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nv4yfy3m.js → roy-agent-core-eaj0b1hm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-3kbf53sh.js → roy-agent-core-ehpnd2be.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-w22tzjj5.js → roy-agent-core-ez91vxas.js} +94 -15
- package/dist/shared/@ai-setting/{roy-agent-core-jw0hbacv.js → roy-agent-core-fxembepv.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-80bdhnwk.js → roy-agent-core-gc75v3px.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-24rmf17n.js → roy-agent-core-gmnex23m.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-qnrf2aw6.js → roy-agent-core-jrj30vq3.js} +33 -2
- package/dist/shared/@ai-setting/{roy-agent-core-atjd1tpt.js → roy-agent-core-keb51jag.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-7z9b1fm8.js → roy-agent-core-m00kamqp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4w6rgxs4.js → roy-agent-core-mdp8y7ky.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v5nknfh0.js → roy-agent-core-mmnac1s6.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-vyygk314.js → roy-agent-core-nna4s0qs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-f79ee0aw.js → roy-agent-core-p4z6nxgz.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-qbm5zy6s.js → roy-agent-core-pr4jekyy.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-rpq0mcvv.js → roy-agent-core-r0t34bbh.js} +79 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ywtmc0bh.js → roy-agent-core-r15sn7ve.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fvkyv5j6.js → roy-agent-core-rmesvpff.js} +12 -12
- package/dist/shared/@ai-setting/{roy-agent-core-9hqqhye6.js → roy-agent-core-sqt96sam.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-2yavqjsh.js → roy-agent-core-v20nxrs1.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-dbkkjmqz.js → roy-agent-core-vc7p80sd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-x7fgze6s.js → roy-agent-core-vkesx61c.js} +4 -4
- package/dist/shared/@ai-setting/roy-agent-core-w6kj6nmj.js +11 -0
- package/dist/shared/@ai-setting/{roy-agent-core-2b4078kz.js → roy-agent-core-wq98qf5y.js} +28 -13
- package/dist/shared/@ai-setting/{roy-agent-core-wtbyj0q1.js → roy-agent-core-wr3pk3h3.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-wsqnf2za.js +19 -0
- package/dist/shared/@ai-setting/{roy-agent-core-v77pp20w.js → roy-agent-core-x36fsm47.js} +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-0pbmweh4.js → roy-agent-core-x7sc21ek.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-w6wagmhw.js → roy-agent-core-xzc53mnk.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-0crh2g0m.js → roy-agent-core-yr3fp8tv.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-m0wp34r4.js → roy-agent-core-z1hm09xp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9abv4ewh.js → roy-agent-core-zdzkzx5g.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-95bbd2jv.js → roy-agent-core-zs4f0tcy.js} +2 -2
- package/dist/utils/temp-file-manager/index.js +4 -4
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-6jqpdjr4.js +0 -19
- package/dist/shared/@ai-setting/roy-agent-core-endah27g.js +0 -81
- package/dist/shared/@ai-setting/roy-agent-core-qfdj8872.js +0 -11
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_decorator,
|
|
3
|
+
wrapFunction
|
|
4
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
5
|
+
import {
|
|
6
|
+
createLogger,
|
|
7
|
+
init_logger
|
|
8
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
9
|
+
import {
|
|
10
|
+
__esm
|
|
11
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
12
|
+
|
|
13
|
+
// src/env/context/env-event.ts
|
|
14
|
+
function isLarkEvent(event) {
|
|
15
|
+
return event?.source === "lark";
|
|
16
|
+
}
|
|
17
|
+
function isGithubEvent(event) {
|
|
18
|
+
return event?.source === "github";
|
|
19
|
+
}
|
|
20
|
+
function isJiraEvent(event) {
|
|
21
|
+
return event?.source === "jira";
|
|
22
|
+
}
|
|
23
|
+
function getLarkMessageId(event) {
|
|
24
|
+
if (!isLarkEvent(event))
|
|
25
|
+
return;
|
|
26
|
+
if (event.id)
|
|
27
|
+
return event.id;
|
|
28
|
+
const payload = event.payload;
|
|
29
|
+
return payload?.message?.message_id ?? payload?.message_id;
|
|
30
|
+
}
|
|
31
|
+
function getLarkChatId(event) {
|
|
32
|
+
if (!isLarkEvent(event))
|
|
33
|
+
return;
|
|
34
|
+
const payload = event.payload;
|
|
35
|
+
return payload?.chat_id ?? payload?.message?.chat_id;
|
|
36
|
+
}
|
|
37
|
+
function getLarkUserId(event) {
|
|
38
|
+
if (!isLarkEvent(event))
|
|
39
|
+
return;
|
|
40
|
+
const payload = event.payload;
|
|
41
|
+
const senderId = payload?.event?.sender?.sender_id ?? payload?.sender?.sender_id ?? undefined;
|
|
42
|
+
return senderId?.open_id ?? senderId?.user_id;
|
|
43
|
+
}
|
|
44
|
+
function serializeEventToEnv(event) {
|
|
45
|
+
if (!event)
|
|
46
|
+
return {};
|
|
47
|
+
const env = {
|
|
48
|
+
[`${EVENT_ENV_PREFIX}SOURCE`]: event.source,
|
|
49
|
+
[`${EVENT_ENV_PREFIX}ID`]: event.id,
|
|
50
|
+
[`${EVENT_ENV_PREFIX}RECEIVED_AT`]: event.receivedAt
|
|
51
|
+
};
|
|
52
|
+
if (event.payload !== undefined) {
|
|
53
|
+
env[`${EVENT_ENV_PREFIX}PAYLOAD`] = JSON.stringify(event.payload);
|
|
54
|
+
}
|
|
55
|
+
if (event.metadata !== undefined) {
|
|
56
|
+
env[`${EVENT_ENV_PREFIX}METADATA`] = JSON.stringify(event.metadata);
|
|
57
|
+
}
|
|
58
|
+
return env;
|
|
59
|
+
}
|
|
60
|
+
function restoreEventFromEnv(env = process.env) {
|
|
61
|
+
const source = env[`${EVENT_ENV_PREFIX}SOURCE`];
|
|
62
|
+
const id = env[`${EVENT_ENV_PREFIX}ID`];
|
|
63
|
+
if (!source || !id)
|
|
64
|
+
return;
|
|
65
|
+
const payloadStr = env[`${EVENT_ENV_PREFIX}PAYLOAD`];
|
|
66
|
+
const metadataStr = env[`${EVENT_ENV_PREFIX}METADATA`];
|
|
67
|
+
let payload;
|
|
68
|
+
let metadata;
|
|
69
|
+
try {
|
|
70
|
+
if (payloadStr)
|
|
71
|
+
payload = JSON.parse(payloadStr);
|
|
72
|
+
} catch {}
|
|
73
|
+
try {
|
|
74
|
+
if (metadataStr)
|
|
75
|
+
metadata = JSON.parse(metadataStr);
|
|
76
|
+
} catch {}
|
|
77
|
+
return {
|
|
78
|
+
source,
|
|
79
|
+
id,
|
|
80
|
+
receivedAt: env[`${EVENT_ENV_PREFIX}RECEIVED_AT`] ?? new Date().toISOString(),
|
|
81
|
+
payload,
|
|
82
|
+
metadata
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
var EVENT_ENV_PREFIX = "ROY_EVENT_";
|
|
86
|
+
var init_env_event = () => {};
|
|
87
|
+
|
|
88
|
+
// src/env/context/env-context.ts
|
|
89
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
90
|
+
function getEnvContext() {
|
|
91
|
+
return envContextStorage.getStore();
|
|
92
|
+
}
|
|
93
|
+
function getEnvContextOrEmpty() {
|
|
94
|
+
return envContextStorage.getStore() || {};
|
|
95
|
+
}
|
|
96
|
+
function hasEnvContext() {
|
|
97
|
+
return envContextStorage.getStore() !== undefined;
|
|
98
|
+
}
|
|
99
|
+
function getCurrentTaskId() {
|
|
100
|
+
return envContextStorage.getStore()?.agentContext?.currentTaskId;
|
|
101
|
+
}
|
|
102
|
+
function runWithEnvContext(context, fn) {
|
|
103
|
+
if (context) {
|
|
104
|
+
return envContextStorage.run(context, fn);
|
|
105
|
+
}
|
|
106
|
+
return fn();
|
|
107
|
+
}
|
|
108
|
+
async function runWithEnvContextAsync(context, fn) {
|
|
109
|
+
if (context) {
|
|
110
|
+
return envContextStorage.run(context, fn);
|
|
111
|
+
}
|
|
112
|
+
return fn();
|
|
113
|
+
}
|
|
114
|
+
function createEnvContext(options) {
|
|
115
|
+
let replyChannel = options.replyChannel;
|
|
116
|
+
if (replyChannel && options.messageId && !replyChannel.messageId) {
|
|
117
|
+
replyChannel = { ...replyChannel, messageId: options.messageId };
|
|
118
|
+
}
|
|
119
|
+
let event = options.event;
|
|
120
|
+
if (!event && options.messageId) {
|
|
121
|
+
event = {
|
|
122
|
+
source: "lark",
|
|
123
|
+
id: options.messageId,
|
|
124
|
+
receivedAt: new Date().toISOString(),
|
|
125
|
+
payload: undefined,
|
|
126
|
+
metadata: {
|
|
127
|
+
chatId: replyChannel?.chatId,
|
|
128
|
+
userId: replyChannel?.userId,
|
|
129
|
+
profile: replyChannel?.profile
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
envEvent: options.envEvent,
|
|
135
|
+
sourceId: options.sourceId,
|
|
136
|
+
userId: options.userId,
|
|
137
|
+
messageId: options.messageId ?? (event?.source === "lark" ? event.id : undefined) ?? replyChannel?.messageId,
|
|
138
|
+
event,
|
|
139
|
+
traceId: options.traceId ?? crypto.randomUUID(),
|
|
140
|
+
requestId: options.requestId ?? crypto.randomUUID(),
|
|
141
|
+
replyChannel,
|
|
142
|
+
pluginEnabled: options.pluginEnabled,
|
|
143
|
+
plugins: options.plugins,
|
|
144
|
+
timestamp: options.timestamp ?? Date.now()
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function mergeEnvContext(partial) {
|
|
148
|
+
const current = envContextStorage.getStore();
|
|
149
|
+
if (current) {
|
|
150
|
+
if (partial.agentContext && current.agentContext) {
|
|
151
|
+
Object.assign(current.agentContext, partial.agentContext);
|
|
152
|
+
delete partial.agentContext;
|
|
153
|
+
}
|
|
154
|
+
Object.assign(current, partial);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function getEventFromEnvContext(ctx) {
|
|
158
|
+
if (!ctx)
|
|
159
|
+
return;
|
|
160
|
+
if (ctx.event)
|
|
161
|
+
return ctx.event;
|
|
162
|
+
const replyMessageId = ctx.replyChannel?.messageId;
|
|
163
|
+
if (replyMessageId) {
|
|
164
|
+
return {
|
|
165
|
+
source: "lark",
|
|
166
|
+
id: replyMessageId,
|
|
167
|
+
receivedAt: new Date().toISOString(),
|
|
168
|
+
payload: undefined,
|
|
169
|
+
metadata: {
|
|
170
|
+
chatId: ctx.replyChannel?.chatId,
|
|
171
|
+
userId: ctx.replyChannel?.userId,
|
|
172
|
+
profile: ctx.replyChannel?.profile
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (ctx.messageId) {
|
|
177
|
+
return {
|
|
178
|
+
source: "lark",
|
|
179
|
+
id: ctx.messageId,
|
|
180
|
+
receivedAt: new Date().toISOString(),
|
|
181
|
+
payload: undefined
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
var logger, envContextStorage, setCurrentTaskId;
|
|
187
|
+
var init_env_context = __esm(() => {
|
|
188
|
+
init_logger();
|
|
189
|
+
init_decorator();
|
|
190
|
+
init_env_event();
|
|
191
|
+
logger = createLogger("env:context:env-context");
|
|
192
|
+
envContextStorage = new AsyncLocalStorage;
|
|
193
|
+
setCurrentTaskId = wrapFunction(function _setCurrentTaskId(taskId) {
|
|
194
|
+
const prev = getCurrentTaskId();
|
|
195
|
+
const ctx = envContextStorage.getStore();
|
|
196
|
+
if (ctx) {
|
|
197
|
+
if (!ctx.agentContext) {
|
|
198
|
+
ctx.agentContext = {};
|
|
199
|
+
}
|
|
200
|
+
ctx.agentContext.currentTaskId = taskId;
|
|
201
|
+
}
|
|
202
|
+
logger.info(`[setCurrentTaskId] taskId=${taskId ?? "undefined"} (was: ${prev ?? "undefined"})`);
|
|
203
|
+
}, "env-context.setCurrentTaskId", { recordParams: true, recordResult: false, log: true });
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export { isLarkEvent, isGithubEvent, isJiraEvent, getLarkMessageId, getLarkChatId, getLarkUserId, EVENT_ENV_PREFIX, serializeEventToEnv, restoreEventFromEnv, init_env_event, envContextStorage, getEnvContext, getEnvContextOrEmpty, hasEnvContext, getCurrentTaskId, runWithEnvContext, runWithEnvContextAsync, createEnvContext, mergeEnvContext, setCurrentTaskId, getEventFromEnvContext, init_env_context };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseComponent
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
12
12
|
|
|
13
13
|
// src/env/commands/commands-component.ts
|
|
14
14
|
import path2 from "path";
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
nodeNotFound,
|
|
8
8
|
pathNotFound,
|
|
9
9
|
unresolvedVariable
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-jrj30vq3.js";
|
|
11
11
|
import {
|
|
12
12
|
TracedAs,
|
|
13
13
|
init_decorator
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
15
15
|
import {
|
|
16
16
|
__esm,
|
|
17
17
|
__legacyDecorateClassTS
|
|
@@ -81,25 +81,104 @@ var init_template_resolver = __esm(() => {
|
|
|
81
81
|
const value = this.resolveTemplateContent(templateContent);
|
|
82
82
|
return value;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
resolvePath(path) {
|
|
85
|
+
if (typeof path !== "string")
|
|
86
|
+
return;
|
|
87
|
+
const trimmed = path.trim();
|
|
88
|
+
if (trimmed === "")
|
|
89
|
+
return;
|
|
90
|
+
let inner = trimmed;
|
|
91
|
+
if (inner.startsWith("{{") && inner.endsWith("}}")) {
|
|
92
|
+
inner = inner.slice(2, -2).trim();
|
|
88
93
|
}
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
94
|
+
if (inner === "")
|
|
95
|
+
return;
|
|
96
|
+
return this.resolveTemplateContent(inner);
|
|
97
|
+
}
|
|
98
|
+
tokenizePath(path) {
|
|
99
|
+
const tokens = [];
|
|
100
|
+
const re = /([^.\[\]]+)|\[(-?\d+)\]/g;
|
|
101
|
+
let m;
|
|
102
|
+
while ((m = re.exec(path)) !== null) {
|
|
103
|
+
if (m[1] !== undefined) {
|
|
104
|
+
tokens.push(m[1]);
|
|
105
|
+
} else if (m[2] !== undefined) {
|
|
106
|
+
tokens.push(parseInt(m[2], 10));
|
|
107
|
+
}
|
|
91
108
|
}
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
return tokens;
|
|
110
|
+
}
|
|
111
|
+
navigateTokens(root, tokens) {
|
|
112
|
+
let current = root;
|
|
113
|
+
for (const token of tokens) {
|
|
114
|
+
if (current === null || current === undefined)
|
|
115
|
+
return;
|
|
116
|
+
if (typeof token === "number") {
|
|
117
|
+
if (!Array.isArray(current))
|
|
118
|
+
return;
|
|
119
|
+
const idx = token < 0 ? current.length + token : token;
|
|
120
|
+
if (idx < 0 || idx >= current.length)
|
|
121
|
+
return;
|
|
122
|
+
current = current[idx];
|
|
123
|
+
} else {
|
|
124
|
+
if (typeof current !== "object")
|
|
125
|
+
return;
|
|
126
|
+
current = current[token];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return current;
|
|
130
|
+
}
|
|
131
|
+
resolveTemplateContent(templateContent) {
|
|
132
|
+
const trimmed = templateContent.trim();
|
|
133
|
+
const tokens = this.tokenizePath(trimmed);
|
|
134
|
+
if (tokens.length === 0)
|
|
135
|
+
return;
|
|
136
|
+
const head = tokens[0];
|
|
137
|
+
if (head === "input" || head === "inputs") {
|
|
138
|
+
const rest = tokens.slice(1);
|
|
139
|
+
if (rest.length === 0)
|
|
140
|
+
return this.input;
|
|
141
|
+
return this.navigateTokens(this.input, rest);
|
|
142
|
+
}
|
|
143
|
+
if (head === "nodes") {
|
|
144
|
+
const rest = tokens.slice(1);
|
|
145
|
+
if (rest.length === 0)
|
|
146
|
+
return;
|
|
147
|
+
const nodeId = rest[0];
|
|
148
|
+
if (typeof nodeId !== "string")
|
|
149
|
+
return;
|
|
150
|
+
const nodeValue = getFromMapWithNormalization(this.previousOutputs, nodeId);
|
|
151
|
+
if (nodeValue === undefined)
|
|
152
|
+
return;
|
|
153
|
+
const pathTokens = rest.slice(1);
|
|
154
|
+
if (pathTokens.length === 0)
|
|
155
|
+
return this.unwrapAgentNodeResult(nodeValue);
|
|
156
|
+
if (pathTokens[0] === "output") {
|
|
157
|
+
if (pathTokens.length === 1) {
|
|
158
|
+
return this.unwrapAgentNodeResult(nodeValue);
|
|
159
|
+
}
|
|
160
|
+
return this.navigateTokens(nodeValue, pathTokens.slice(1));
|
|
161
|
+
}
|
|
162
|
+
return this.navigateTokens(nodeValue, pathTokens);
|
|
94
163
|
}
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
164
|
+
if (typeof head === "string" && head !== "nodes") {
|
|
165
|
+
const nodeId = head;
|
|
166
|
+
const nodeValue = getFromMapWithNormalization(this.previousOutputs, nodeId);
|
|
167
|
+
if (nodeValue === undefined)
|
|
168
|
+
return;
|
|
169
|
+
const pathTokens = tokens.slice(1);
|
|
170
|
+
if (pathTokens.length === 0)
|
|
171
|
+
return this.unwrapAgentNodeResult(nodeValue);
|
|
172
|
+
return this.navigateTokens(nodeValue, pathTokens);
|
|
100
173
|
}
|
|
101
174
|
return;
|
|
102
175
|
}
|
|
176
|
+
unwrapAgentNodeResult(value) {
|
|
177
|
+
if (value && typeof value === "object" && "result" in value && !("nodes" in value)) {
|
|
178
|
+
return value.result;
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
103
182
|
resolveString(template) {
|
|
104
183
|
if (!template || typeof template !== "string") {
|
|
105
184
|
return template;
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
WorkflowRepository,
|
|
3
3
|
migrateEmptyTagsToDefault,
|
|
4
4
|
rowToWorkflow
|
|
5
|
-
} from "./roy-agent-core-
|
|
6
|
-
import"./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-ajp566yv.js";
|
|
6
|
+
import"./roy-agent-core-atpchjdz.js";
|
|
7
7
|
import"./roy-agent-core-rvxg1wps.js";
|
|
8
|
-
import"./roy-agent-core-
|
|
9
|
-
import"./roy-agent-core-
|
|
10
|
-
import"./roy-agent-core-
|
|
11
|
-
import"./roy-agent-core-
|
|
8
|
+
import"./roy-agent-core-96mj6gvc.js";
|
|
9
|
+
import"./roy-agent-core-nna4s0qs.js";
|
|
10
|
+
import"./roy-agent-core-m00kamqp.js";
|
|
11
|
+
import"./roy-agent-core-4an1p9a1.js";
|
|
12
12
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
13
13
|
export {
|
|
14
14
|
rowToWorkflow,
|
|
@@ -3,21 +3,21 @@ 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-akb8mb9v.js";
|
|
7
7
|
import {
|
|
8
8
|
globalHookManager,
|
|
9
9
|
init_global_hook_manager
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
11
11
|
import {
|
|
12
12
|
init_context
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-sqt96sam.js";
|
|
14
14
|
import {
|
|
15
15
|
getEnvContextOrEmpty
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
17
17
|
import {
|
|
18
18
|
createLogger,
|
|
19
19
|
init_logger
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
21
21
|
|
|
22
22
|
// src/env/plugin/event-bus-notification-channel.ts
|
|
23
23
|
init_logger();
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
globalHookManager,
|
|
11
11
|
init_global_hook_manager
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
13
13
|
import {
|
|
14
14
|
TracedAs,
|
|
15
15
|
init_decorator,
|
|
16
16
|
wrapFunction
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
18
18
|
import {
|
|
19
19
|
createLogger,
|
|
20
20
|
init_logger
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
22
22
|
import {
|
|
23
23
|
__esm,
|
|
24
24
|
__legacyDecorateClassTS
|
|
@@ -68,7 +68,7 @@ function parseWorkflowFileSync(content, filename) {
|
|
|
68
68
|
definition
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
var DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, yamlParser = null;
|
|
71
|
+
var DependsOnSchema, RetryConfigSchema, LoopGuardConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, yamlParser = null;
|
|
72
72
|
var init_workflow = __esm(() => {
|
|
73
73
|
init_edge();
|
|
74
74
|
DependsOnSchema = z2.array(z2.string());
|
|
@@ -77,6 +77,14 @@ var init_workflow = __esm(() => {
|
|
|
77
77
|
backoff: z2.enum(["fixed", "exponential"]).default("exponential"),
|
|
78
78
|
initial_delay: z2.number().min(0).default(1000)
|
|
79
79
|
});
|
|
80
|
+
LoopGuardConfigSchema = z2.object({
|
|
81
|
+
type: z2.literal("value_unchanged"),
|
|
82
|
+
previous_signal: z2.string().min(1, "previous_signal must be a non-empty template path"),
|
|
83
|
+
current_signal_command: z2.string().min(1, "current_signal_command must be a non-empty shell command"),
|
|
84
|
+
cwd: z2.string().optional(),
|
|
85
|
+
max_consecutive_no_progress: z2.number().int().min(1).default(1),
|
|
86
|
+
fail_message: z2.string().optional()
|
|
87
|
+
});
|
|
80
88
|
NodeDefinitionSchema = z2.object({
|
|
81
89
|
id: z2.string().min(1, "Node ID is required"),
|
|
82
90
|
type: z2.string().min(1, "Node type is required"),
|
|
@@ -86,6 +94,29 @@ var init_workflow = __esm(() => {
|
|
|
86
94
|
condition: z2.string().optional(),
|
|
87
95
|
retry: RetryConfigSchema.optional(),
|
|
88
96
|
timeout: z2.number().optional()
|
|
97
|
+
}).superRefine((value, ctx) => {
|
|
98
|
+
const config = value.config ?? {};
|
|
99
|
+
if (Object.prototype.hasOwnProperty.call(config, "loop_guard")) {
|
|
100
|
+
const parsed = LoopGuardConfigSchema.safeParse(config.loop_guard);
|
|
101
|
+
if (!parsed.success) {
|
|
102
|
+
for (const issue of parsed.error.issues) {
|
|
103
|
+
ctx.addIssue({
|
|
104
|
+
code: z2.ZodIssueCode.custom,
|
|
105
|
+
path: ["config", "loop_guard", ...issue.path ?? []],
|
|
106
|
+
message: issue.message
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}).transform((value) => {
|
|
112
|
+
const config = value.config ?? {};
|
|
113
|
+
if (Object.prototype.hasOwnProperty.call(config, "loop_guard")) {
|
|
114
|
+
const parsed = LoopGuardConfigSchema.safeParse(config.loop_guard);
|
|
115
|
+
if (parsed.success) {
|
|
116
|
+
value.config = { ...config, loop_guard: parsed.data };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
89
120
|
});
|
|
90
121
|
WorkflowConfigSchema = z2.object({
|
|
91
122
|
parallel_limit: z2.number().nullable().optional(),
|
|
@@ -438,4 +469,4 @@ var init_types = __esm(() => {
|
|
|
438
469
|
init_run();
|
|
439
470
|
});
|
|
440
471
|
|
|
441
|
-
export {
|
|
472
|
+
export { EdgeDefinitionSchema, DependsOnSchema, RetryConfigSchema, LoopGuardConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, parseWorkflowFile, parseWorkflowFileSync, WorkflowMessageRoleSchema, isWorkflowSessionMetadata, getWorkflowSessionStatus, BaseEventSchema, WorkflowStartedEventSchema, WorkflowPausedEventSchema, WorkflowResumedEventSchema, WorkflowStoppedEventSchema, WorkflowCompletedEventSchema, WorkflowFailedEventSchema, WorkflowOutputEventSchema, NodeScheduledEventSchema, NodeStartedEventSchema, NodeProgressEventSchema, NodeCompletedEventSchema, NodeFailedEventSchema, NodeSkippedEventSchema, NodeDataEventSchema, NodeAddedEventSchema, NodeRemovedEventSchema, ControlPauseEventSchema, ControlResumeEventSchema, ControlStopEventSchema, NodeInterruptEventSchema, WorkflowAskUserEventSchema, WorkflowEventSchema, createWorkflowEvent, init_event, RunStatusSchema, NodeStatusSchema, createNodeExecutionContext, WorkflowError, TemplateUnresolvedError, WorkflowValidationError, nodeNotFound, pathNotFound, unresolvedVariable, init_workflow_error, init_types };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-rvv6ydff.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseComponent
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
8
8
|
import {
|
|
9
9
|
__require
|
|
10
10
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -141,7 +141,7 @@ class SpanDbReader {
|
|
|
141
141
|
}
|
|
142
142
|
async initSqliteStorage() {
|
|
143
143
|
try {
|
|
144
|
-
const { SQLiteSpanStorage } = await import("./roy-agent-core-
|
|
144
|
+
const { SQLiteSpanStorage } = await import("./roy-agent-core-z1hm09xp.js");
|
|
145
145
|
this.storage = new SQLiteSpanStorage(this.dbPath);
|
|
146
146
|
await this.storage.initialize();
|
|
147
147
|
} catch (error) {
|
|
@@ -590,7 +590,7 @@ class DebugComponent extends BaseComponent {
|
|
|
590
590
|
}
|
|
591
591
|
async getLiveTrace(traceId) {
|
|
592
592
|
try {
|
|
593
|
-
const { getTracerProvider } = await import("./roy-agent-core-
|
|
593
|
+
const { getTracerProvider } = await import("./roy-agent-core-xzc53mnk.js");
|
|
594
594
|
const provider = getTracerProvider();
|
|
595
595
|
if (!provider.isInitialized()) {
|
|
596
596
|
await provider.initialize();
|
|
@@ -635,7 +635,7 @@ class DebugComponent extends BaseComponent {
|
|
|
635
635
|
}
|
|
636
636
|
async listLiveTraces(limit = 20) {
|
|
637
637
|
try {
|
|
638
|
-
const { getTracerProvider } = await import("./roy-agent-core-
|
|
638
|
+
const { getTracerProvider } = await import("./roy-agent-core-xzc53mnk.js");
|
|
639
639
|
const provider = getTracerProvider();
|
|
640
640
|
if (!provider.isInitialized()) {
|
|
641
641
|
await provider.initialize();
|
|
@@ -653,7 +653,7 @@ class DebugComponent extends BaseComponent {
|
|
|
653
653
|
}
|
|
654
654
|
async formatLiveTrace(traceId) {
|
|
655
655
|
try {
|
|
656
|
-
const { getTracerProvider } = await import("./roy-agent-core-
|
|
656
|
+
const { getTracerProvider } = await import("./roy-agent-core-xzc53mnk.js");
|
|
657
657
|
const provider = getTracerProvider();
|
|
658
658
|
if (!provider.isInitialized()) {
|
|
659
659
|
await provider.initialize();
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
TracedAs,
|
|
6
6
|
init_decorator
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
12
12
|
import {
|
|
13
13
|
__legacyDecorateClassTS
|
|
14
14
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
hasDecoratorNodes,
|
|
4
4
|
init_node_registry_helper,
|
|
5
5
|
registerDecoratorNodeType
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-77wfej1h.js";
|
|
7
7
|
import"./roy-agent-core-ddwa0n6h.js";
|
|
8
8
|
import"./roy-agent-core-1ce3fqrk.js";
|
|
9
|
-
import"./roy-agent-core-
|
|
10
|
-
import"./roy-agent-core-
|
|
11
|
-
import"./roy-agent-core-
|
|
12
|
-
import"./roy-agent-core-
|
|
9
|
+
import"./roy-agent-core-96mj6gvc.js";
|
|
10
|
+
import"./roy-agent-core-nna4s0qs.js";
|
|
11
|
+
import"./roy-agent-core-m00kamqp.js";
|
|
12
|
+
import"./roy-agent-core-4an1p9a1.js";
|
|
13
13
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
14
14
|
init_node_registry_helper();
|
|
15
15
|
|
|
@@ -5,13 +5,13 @@ 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-ajp566yv.js";
|
|
9
|
+
import"./roy-agent-core-atpchjdz.js";
|
|
10
10
|
import"./roy-agent-core-rvxg1wps.js";
|
|
11
|
-
import"./roy-agent-core-
|
|
12
|
-
import"./roy-agent-core-
|
|
13
|
-
import"./roy-agent-core-
|
|
14
|
-
import"./roy-agent-core-
|
|
11
|
+
import"./roy-agent-core-96mj6gvc.js";
|
|
12
|
+
import"./roy-agent-core-nna4s0qs.js";
|
|
13
|
+
import"./roy-agent-core-m00kamqp.js";
|
|
14
|
+
import"./roy-agent-core-4an1p9a1.js";
|
|
15
15
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
16
16
|
export {
|
|
17
17
|
resetDatabase,
|