@ai-setting/roy-agent-core 1.5.13-test → 1.5.15-test
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/package.json +1 -1
- package/dist/config/index.d.ts +0 -1250
- package/dist/config/index.js +0 -32
- package/dist/env/agent/index.d.ts +0 -2279
- package/dist/env/agent/index.js +0 -24
- package/dist/env/commands/index.d.ts +0 -1131
- package/dist/env/commands/index.js +0 -14
- package/dist/env/debug/formatters/index.d.ts +0 -236
- package/dist/env/debug/formatters/index.js +0 -11
- package/dist/env/debug/index.d.ts +0 -1652
- package/dist/env/debug/index.js +0 -26
- package/dist/env/hook/index.d.ts +0 -279
- package/dist/env/hook/index.js +0 -29
- package/dist/env/index.d.ts +0 -3481
- package/dist/env/index.js +0 -82
- package/dist/env/llm/index.d.ts +0 -1760
- package/dist/env/llm/index.js +0 -40
- package/dist/env/log-trace/index.d.ts +0 -1574
- package/dist/env/log-trace/index.js +0 -83
- package/dist/env/mcp/index.d.ts +0 -1331
- package/dist/env/mcp/index.js +0 -39
- package/dist/env/mcp/tool/index.d.ts +0 -183
- package/dist/env/mcp/tool/index.js +0 -14
- package/dist/env/memory/built-in/index.d.ts +0 -232
- package/dist/env/memory/built-in/index.js +0 -11
- package/dist/env/memory/index.d.ts +0 -1799
- package/dist/env/memory/index.js +0 -56
- package/dist/env/memory/plugin/index.d.ts +0 -747
- package/dist/env/memory/plugin/index.js +0 -36
- package/dist/env/prompt/index.d.ts +0 -1164
- package/dist/env/prompt/index.js +0 -20
- package/dist/env/session/index.d.ts +0 -1908
- package/dist/env/session/index.js +0 -25
- package/dist/env/session/storage/index.d.ts +0 -564
- package/dist/env/session/storage/index.js +0 -18
- package/dist/env/skill/index.d.ts +0 -1266
- package/dist/env/skill/index.js +0 -34
- package/dist/env/skill/tool/index.d.ts +0 -193
- package/dist/env/skill/tool/index.js +0 -9
- package/dist/env/task/delegate/index.d.ts +0 -1612
- package/dist/env/task/delegate/index.js +0 -18
- package/dist/env/task/events/index.d.ts +0 -171
- package/dist/env/task/events/index.js +0 -7
- package/dist/env/task/hooks/index.d.ts +0 -624
- package/dist/env/task/hooks/index.js +0 -7
- package/dist/env/task/index.d.ts +0 -1553
- package/dist/env/task/index.js +0 -34
- package/dist/env/task/plugins/index.d.ts +0 -466
- package/dist/env/task/plugins/index.js +0 -23
- package/dist/env/task/storage/index.d.ts +0 -241
- package/dist/env/task/storage/index.js +0 -14
- package/dist/env/task/tools/index.d.ts +0 -1485
- package/dist/env/task/tools/index.js +0 -17
- package/dist/env/task/tools/operation/index.d.ts +0 -1484
- package/dist/env/task/tools/operation/index.js +0 -15
- package/dist/env/tool/built-in/index.d.ts +0 -218
- package/dist/env/tool/built-in/index.js +0 -25
- package/dist/env/tool/index.d.ts +0 -1396
- package/dist/env/tool/index.js +0 -39
- package/dist/env/workflow/decorators/index.d.ts +0 -2161
- package/dist/env/workflow/decorators/index.js +0 -27
- package/dist/env/workflow/engine/index.d.ts +0 -3453
- package/dist/env/workflow/engine/index.js +0 -28
- package/dist/env/workflow/index.d.ts +0 -3546
- package/dist/env/workflow/index.js +0 -136
- package/dist/env/workflow/nodes/index.d.ts +0 -2092
- package/dist/env/workflow/nodes/index.js +0 -19
- package/dist/env/workflow/service/index.d.ts +0 -227
- package/dist/env/workflow/service/index.js +0 -13
- package/dist/env/workflow/storage/index.d.ts +0 -165
- package/dist/env/workflow/storage/index.js +0 -27
- package/dist/env/workflow/tools/index.d.ts +0 -416
- package/dist/env/workflow/tools/index.js +0 -159
- package/dist/env/workflow/types/index.d.ts +0 -2255
- package/dist/env/workflow/types/index.js +0 -98
- package/dist/env/workflow/utils/index.d.ts +0 -2031
- package/dist/env/workflow/utils/index.js +0 -637
- package/dist/index.d.ts +0 -7858
- package/dist/index.js +0 -399
- package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +0 -258
- package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +0 -36
- package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +0 -349
- package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +0 -117
- package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +0 -200
- package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +0 -299
- package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +0 -206
- package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +0 -180
- package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +0 -408
- package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +0 -284
- package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +0 -762
- package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +0 -922
- package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +0 -1130
- package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +0 -653
- package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +0 -93
- package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +0 -872
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +0 -64
- package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +0 -378
- package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +0 -492
- package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +0 -52
- package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +0 -171
- package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +0 -862
- package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +0 -1387
- package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +0 -208
- package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +0 -139
- package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +0 -534
- package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +0 -204
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
- package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +0 -97
- package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +0 -587
- package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +0 -176
- package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +0 -60
- package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +0 -442
- package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +0 -57
- package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +0 -66
- package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +0 -267
- package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +0 -584
- package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +0 -102
- package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +0 -549
- package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +0 -213
- package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +0 -812
- package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +0 -1316
- package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +0 -1205
- package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +0 -328
- package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +0 -20
- package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +0 -2098
- package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +0 -419
- package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +0 -368
- package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +0 -377
- package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +0 -172
- package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +0 -103
package/dist/index.js
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CommandsComponent
|
|
3
|
-
} from "./shared/@ai-setting/roy-agent-core-f7q2x5z6.js";
|
|
4
|
-
import {
|
|
5
|
-
LogTraceComponent,
|
|
6
|
-
LogTraceConfigSchema
|
|
7
|
-
} from "./shared/@ai-setting/roy-agent-core-xq8hhqb8.js";
|
|
8
|
-
import {
|
|
9
|
-
ToolComponent,
|
|
10
|
-
ToolRegistry,
|
|
11
|
-
ToolValidator
|
|
12
|
-
} from "./shared/@ai-setting/roy-agent-core-qqceba6k.js";
|
|
13
|
-
import {
|
|
14
|
-
bashTool,
|
|
15
|
-
editFileTool,
|
|
16
|
-
getAllBuiltInTools,
|
|
17
|
-
getBuiltInTool,
|
|
18
|
-
globTool,
|
|
19
|
-
grepTool,
|
|
20
|
-
readFileTool,
|
|
21
|
-
writeFileTool
|
|
22
|
-
} from "./shared/@ai-setting/roy-agent-core-satmq6sh.js";
|
|
23
|
-
import {
|
|
24
|
-
PromptComponent,
|
|
25
|
-
getBuiltInPrompt,
|
|
26
|
-
getBuiltInPromptNames
|
|
27
|
-
} from "./shared/@ai-setting/roy-agent-core-93zfb3r1.js";
|
|
28
|
-
import {
|
|
29
|
-
LLMComponent,
|
|
30
|
-
LLMConfigSchema,
|
|
31
|
-
LLMDefaultConfigSchema,
|
|
32
|
-
ModelLimitsSchema,
|
|
33
|
-
ProviderCapabilitiesSchema,
|
|
34
|
-
ProviderConfigSchema,
|
|
35
|
-
createInvokeConfig,
|
|
36
|
-
invoke,
|
|
37
|
-
invokeNonStream,
|
|
38
|
-
parseModelString
|
|
39
|
-
} from "./shared/@ai-setting/roy-agent-core-vkz81f7v.js";
|
|
40
|
-
import {
|
|
41
|
-
ConfigComponent
|
|
42
|
-
} from "./shared/@ai-setting/roy-agent-core-vn2bc59q.js";
|
|
43
|
-
import {
|
|
44
|
-
MemoryComponent
|
|
45
|
-
} from "./shared/@ai-setting/roy-agent-core-4txzpsbt.js";
|
|
46
|
-
import"./shared/@ai-setting/roy-agent-core-g1s2h0e5.js";
|
|
47
|
-
import {
|
|
48
|
-
MemoryPlugin,
|
|
49
|
-
createMemoryPlugin
|
|
50
|
-
} from "./shared/@ai-setting/roy-agent-core-6kvtahqv.js";
|
|
51
|
-
import {
|
|
52
|
-
TaskPlugin,
|
|
53
|
-
TaskTagPlugin
|
|
54
|
-
} from "./shared/@ai-setting/roy-agent-core-3jywqmdd.js";
|
|
55
|
-
import {
|
|
56
|
-
DebugComponent
|
|
57
|
-
} from "./shared/@ai-setting/roy-agent-core-g99pxzn5.js";
|
|
58
|
-
import {
|
|
59
|
-
ReplFormatter,
|
|
60
|
-
TraceFormatter,
|
|
61
|
-
TreeFormatter
|
|
62
|
-
} from "./shared/@ai-setting/roy-agent-core-rvv6ydff.js";
|
|
63
|
-
import {
|
|
64
|
-
BaseEnvironment,
|
|
65
|
-
EventSourceAgentHandler,
|
|
66
|
-
EventSourceComponent,
|
|
67
|
-
generateDescendingId,
|
|
68
|
-
generateId
|
|
69
|
-
} from "./shared/@ai-setting/roy-agent-core-gbqcyegm.js";
|
|
70
|
-
import {
|
|
71
|
-
XDG_PATHS,
|
|
72
|
-
getXDGPath,
|
|
73
|
-
getXDGPaths
|
|
74
|
-
} from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
75
|
-
import {
|
|
76
|
-
WorkflowComponent
|
|
77
|
-
} from "./shared/@ai-setting/roy-agent-core-rhmtwnw1.js";
|
|
78
|
-
import {
|
|
79
|
-
init_node_registry_helper,
|
|
80
|
-
registerDecoratorNodeType
|
|
81
|
-
} from "./shared/@ai-setting/roy-agent-core-0rtxwr28.js";
|
|
82
|
-
import"./shared/@ai-setting/roy-agent-core-wrcy0h6z.js";
|
|
83
|
-
import"./shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
84
|
-
import"./shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
85
|
-
import"./shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
86
|
-
import"./shared/@ai-setting/roy-agent-core-5x94xmt6.js";
|
|
87
|
-
import"./shared/@ai-setting/roy-agent-core-0vbdz0x7.js";
|
|
88
|
-
import {
|
|
89
|
-
Edge,
|
|
90
|
-
NodeAs,
|
|
91
|
-
Workflow,
|
|
92
|
-
WorkflowEdges,
|
|
93
|
-
createWorkflowFromClass
|
|
94
|
-
} from "./shared/@ai-setting/roy-agent-core-7fgf85wc.js";
|
|
95
|
-
import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
96
|
-
import {
|
|
97
|
-
AgentComponent,
|
|
98
|
-
AgentComponentConfigSchema
|
|
99
|
-
} from "./shared/@ai-setting/roy-agent-core-b0x5dda6.js";
|
|
100
|
-
import {
|
|
101
|
-
AskUserError,
|
|
102
|
-
init_workflow_hil
|
|
103
|
-
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
104
|
-
import {
|
|
105
|
-
TaskComponent
|
|
106
|
-
} from "./shared/@ai-setting/roy-agent-core-gwc4h96n.js";
|
|
107
|
-
import"./shared/@ai-setting/roy-agent-core-vf215qfv.js";
|
|
108
|
-
import"./shared/@ai-setting/roy-agent-core-bvr1761x.js";
|
|
109
|
-
import"./shared/@ai-setting/roy-agent-core-wa1kzqky.js";
|
|
110
|
-
import"./shared/@ai-setting/roy-agent-core-t94ktchq.js";
|
|
111
|
-
import {
|
|
112
|
-
TaskHookPoints
|
|
113
|
-
} from "./shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
114
|
-
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
115
|
-
import {
|
|
116
|
-
SkillComponent
|
|
117
|
-
} from "./shared/@ai-setting/roy-agent-core-zbkpc41z.js";
|
|
118
|
-
import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
|
|
119
|
-
import {
|
|
120
|
-
McpComponent
|
|
121
|
-
} from "./shared/@ai-setting/roy-agent-core-pjr12nnd.js";
|
|
122
|
-
import {
|
|
123
|
-
AgentError,
|
|
124
|
-
ComponentError,
|
|
125
|
-
ContextError,
|
|
126
|
-
ErrorCodes,
|
|
127
|
-
LLMError,
|
|
128
|
-
RoyError,
|
|
129
|
-
ToolError,
|
|
130
|
-
getErrorCode,
|
|
131
|
-
isRoyError
|
|
132
|
-
} from "./shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
133
|
-
import"./shared/@ai-setting/roy-agent-core-1akcqxj9.js";
|
|
134
|
-
import {
|
|
135
|
-
SessionComponent
|
|
136
|
-
} from "./shared/@ai-setting/roy-agent-core-81w1963m.js";
|
|
137
|
-
import"./shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
138
|
-
import"./shared/@ai-setting/roy-agent-core-eajcvp4e.js";
|
|
139
|
-
import"./shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
140
|
-
import {
|
|
141
|
-
BaseComponent
|
|
142
|
-
} from "./shared/@ai-setting/roy-agent-core-kkbwepqb.js";
|
|
143
|
-
import {
|
|
144
|
-
createHook,
|
|
145
|
-
createPriorityHook
|
|
146
|
-
} from "./shared/@ai-setting/roy-agent-core-2dhd60aw.js";
|
|
147
|
-
import {
|
|
148
|
-
HookManager,
|
|
149
|
-
globalHookManager
|
|
150
|
-
} from "./shared/@ai-setting/roy-agent-core-gjq1yk68.js";
|
|
151
|
-
import {
|
|
152
|
-
MemorySessionStore
|
|
153
|
-
} from "./shared/@ai-setting/roy-agent-core-d7cyjkf7.js";
|
|
154
|
-
import"./shared/@ai-setting/roy-agent-core-jfh9q2qh.js";
|
|
155
|
-
import {
|
|
156
|
-
Traced,
|
|
157
|
-
TracedAs,
|
|
158
|
-
TracedLightweight,
|
|
159
|
-
wrapFunction
|
|
160
|
-
} from "./shared/@ai-setting/roy-agent-core-zgypchmt.js";
|
|
161
|
-
import {
|
|
162
|
-
createLogger,
|
|
163
|
-
getLogDir,
|
|
164
|
-
getLogLevel,
|
|
165
|
-
getLogLevels,
|
|
166
|
-
isQuietMode,
|
|
167
|
-
setConfigComponent,
|
|
168
|
-
setLogDirOverride,
|
|
169
|
-
setQuietMode
|
|
170
|
-
} from "./shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
171
|
-
import {
|
|
172
|
-
OTelTracerProvider,
|
|
173
|
-
SpanKind,
|
|
174
|
-
SpanStatus,
|
|
175
|
-
getTracerProvider,
|
|
176
|
-
propagation,
|
|
177
|
-
resetTracerProvider
|
|
178
|
-
} from "./shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
179
|
-
import {
|
|
180
|
-
SQLiteSpanStorage
|
|
181
|
-
} from "./shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
182
|
-
import"./shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
183
|
-
// src/env/memory/tools/memory-agent-tools.ts
|
|
184
|
-
import { z } from "zod";
|
|
185
|
-
var SearchSessionsSchema = z.object({
|
|
186
|
-
query: z.string().describe("搜索关键词"),
|
|
187
|
-
session_id: z.string().optional().describe("可选:限制特定 session"),
|
|
188
|
-
limit: z.number().optional().default(10).describe("返回数量限制")
|
|
189
|
-
});
|
|
190
|
-
var GetSessionSchema = z.object({
|
|
191
|
-
session_id: z.string().describe("Session ID")
|
|
192
|
-
});
|
|
193
|
-
var WriteMemorySchema = z.object({
|
|
194
|
-
scope: z.enum(["project", "global"]).describe("作用域"),
|
|
195
|
-
content: z.string().describe("新的记忆内容(Markdown 格式)")
|
|
196
|
-
});
|
|
197
|
-
function createMemoryAgentTools(deps) {
|
|
198
|
-
const searchSessions = {
|
|
199
|
-
name: "search_sessions",
|
|
200
|
-
description: "搜索会话历史,返回匹配的会话摘要列表",
|
|
201
|
-
parameters: SearchSessionsSchema,
|
|
202
|
-
execute: async (args, ctx) => {
|
|
203
|
-
try {
|
|
204
|
-
const params = SearchSessionsSchema.parse(args);
|
|
205
|
-
const results = await deps.sessionComponent.searchSessions(params.query, {
|
|
206
|
-
session_id: params.session_id,
|
|
207
|
-
limit: params.limit
|
|
208
|
-
});
|
|
209
|
-
return {
|
|
210
|
-
success: true,
|
|
211
|
-
output: JSON.stringify(results, null, 2),
|
|
212
|
-
metadata: {
|
|
213
|
-
execution_time_ms: 0,
|
|
214
|
-
count: results.length
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
} catch (error) {
|
|
218
|
-
return {
|
|
219
|
-
success: false,
|
|
220
|
-
output: "",
|
|
221
|
-
error: error instanceof Error ? error.message : String(error),
|
|
222
|
-
metadata: { execution_time_ms: 0 }
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
const getSession = {
|
|
228
|
-
name: "get_session",
|
|
229
|
-
description: "获取指定会话的完整内容",
|
|
230
|
-
parameters: GetSessionSchema,
|
|
231
|
-
execute: async (args, ctx) => {
|
|
232
|
-
try {
|
|
233
|
-
const params = GetSessionSchema.parse(args);
|
|
234
|
-
const session = await deps.sessionComponent.getSession(params.session_id);
|
|
235
|
-
if (!session) {
|
|
236
|
-
return {
|
|
237
|
-
success: false,
|
|
238
|
-
output: "",
|
|
239
|
-
error: `Session not found: ${params.session_id}`,
|
|
240
|
-
metadata: { execution_time_ms: 0 }
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
return {
|
|
244
|
-
success: true,
|
|
245
|
-
output: JSON.stringify(session, null, 2),
|
|
246
|
-
metadata: {
|
|
247
|
-
execution_time_ms: 0,
|
|
248
|
-
session_id: session.sessionId
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
} catch (error) {
|
|
252
|
-
return {
|
|
253
|
-
success: false,
|
|
254
|
-
output: "",
|
|
255
|
-
error: error instanceof Error ? error.message : String(error),
|
|
256
|
-
metadata: { execution_time_ms: 0 }
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
const writeMemory = {
|
|
262
|
-
name: "write_memory",
|
|
263
|
-
description: "写入记忆文件(覆盖模式)",
|
|
264
|
-
parameters: WriteMemorySchema,
|
|
265
|
-
execute: async (args, ctx) => {
|
|
266
|
-
try {
|
|
267
|
-
const params = WriteMemorySchema.parse(args);
|
|
268
|
-
await deps.memoryComponent.recordMemory({
|
|
269
|
-
mode: "overwrite",
|
|
270
|
-
content: params.content,
|
|
271
|
-
scope: params.scope
|
|
272
|
-
});
|
|
273
|
-
return {
|
|
274
|
-
success: true,
|
|
275
|
-
output: `Memory updated successfully (${params.scope})`,
|
|
276
|
-
metadata: {
|
|
277
|
-
execution_time_ms: 0,
|
|
278
|
-
scope: params.scope
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
} catch (error) {
|
|
282
|
-
return {
|
|
283
|
-
success: false,
|
|
284
|
-
output: "",
|
|
285
|
-
error: error instanceof Error ? error.message : String(error),
|
|
286
|
-
metadata: { execution_time_ms: 0 }
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
return {
|
|
292
|
-
searchSessions,
|
|
293
|
-
getSession,
|
|
294
|
-
writeMemory,
|
|
295
|
-
bash: bashTool,
|
|
296
|
-
read_file: readFileTool
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// src/index.ts
|
|
301
|
-
init_workflow_hil();
|
|
302
|
-
init_node_registry_helper();
|
|
303
|
-
export {
|
|
304
|
-
writeFileTool,
|
|
305
|
-
wrapFunction,
|
|
306
|
-
setQuietMode,
|
|
307
|
-
setConfigComponent as setLoggerConfigComponent,
|
|
308
|
-
setLogDirOverride,
|
|
309
|
-
resetTracerProvider,
|
|
310
|
-
registerDecoratorNodeType,
|
|
311
|
-
readFileTool,
|
|
312
|
-
propagation,
|
|
313
|
-
parseModelString,
|
|
314
|
-
isRoyError,
|
|
315
|
-
isQuietMode,
|
|
316
|
-
invokeNonStream,
|
|
317
|
-
invoke,
|
|
318
|
-
grepTool,
|
|
319
|
-
globalHookManager,
|
|
320
|
-
globTool,
|
|
321
|
-
getXDGPaths,
|
|
322
|
-
getXDGPath,
|
|
323
|
-
getTracerProvider,
|
|
324
|
-
getLogLevels,
|
|
325
|
-
getLogLevel,
|
|
326
|
-
getLogDir,
|
|
327
|
-
getErrorCode,
|
|
328
|
-
getBuiltInTool,
|
|
329
|
-
getBuiltInPromptNames,
|
|
330
|
-
getBuiltInPrompt,
|
|
331
|
-
getAllBuiltInTools,
|
|
332
|
-
generateId,
|
|
333
|
-
generateDescendingId,
|
|
334
|
-
editFileTool,
|
|
335
|
-
createWorkflowFromClass,
|
|
336
|
-
createPriorityHook,
|
|
337
|
-
createMemoryPlugin,
|
|
338
|
-
createMemoryAgentTools,
|
|
339
|
-
createLogger,
|
|
340
|
-
createInvokeConfig,
|
|
341
|
-
createHook,
|
|
342
|
-
bashTool,
|
|
343
|
-
XDG_PATHS,
|
|
344
|
-
WorkflowEdges,
|
|
345
|
-
WorkflowComponent,
|
|
346
|
-
Workflow,
|
|
347
|
-
TreeFormatter,
|
|
348
|
-
TracedLightweight,
|
|
349
|
-
TracedAs,
|
|
350
|
-
Traced,
|
|
351
|
-
TraceFormatter,
|
|
352
|
-
ToolValidator,
|
|
353
|
-
ToolRegistry,
|
|
354
|
-
ToolError,
|
|
355
|
-
ToolComponent,
|
|
356
|
-
TaskTagPlugin,
|
|
357
|
-
TaskPlugin,
|
|
358
|
-
TaskHookPoints,
|
|
359
|
-
TaskComponent,
|
|
360
|
-
SpanStatus,
|
|
361
|
-
SpanKind,
|
|
362
|
-
SkillComponent,
|
|
363
|
-
SessionComponent,
|
|
364
|
-
SQLiteSpanStorage,
|
|
365
|
-
RoyError,
|
|
366
|
-
ReplFormatter,
|
|
367
|
-
ProviderConfigSchema,
|
|
368
|
-
ProviderCapabilitiesSchema,
|
|
369
|
-
PromptComponent,
|
|
370
|
-
OTelTracerProvider,
|
|
371
|
-
NodeAs,
|
|
372
|
-
ModelLimitsSchema,
|
|
373
|
-
MemorySessionStore,
|
|
374
|
-
MemoryPlugin,
|
|
375
|
-
MemoryComponent,
|
|
376
|
-
McpComponent,
|
|
377
|
-
LogTraceConfigSchema,
|
|
378
|
-
LogTraceComponent,
|
|
379
|
-
LLMError,
|
|
380
|
-
LLMDefaultConfigSchema,
|
|
381
|
-
LLMConfigSchema,
|
|
382
|
-
LLMComponent,
|
|
383
|
-
HookManager,
|
|
384
|
-
EventSourceComponent,
|
|
385
|
-
EventSourceAgentHandler,
|
|
386
|
-
ErrorCodes,
|
|
387
|
-
Edge,
|
|
388
|
-
DebugComponent,
|
|
389
|
-
ContextError,
|
|
390
|
-
ConfigComponent,
|
|
391
|
-
ComponentError,
|
|
392
|
-
CommandsComponent,
|
|
393
|
-
BaseEnvironment,
|
|
394
|
-
BaseComponent,
|
|
395
|
-
AskUserError,
|
|
396
|
-
AgentError,
|
|
397
|
-
AgentComponentConfigSchema,
|
|
398
|
-
AgentComponent
|
|
399
|
-
};
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DecoratorNode,
|
|
3
|
-
init_decorator_node
|
|
4
|
-
} from "./roy-agent-core-1ce3fqrk.js";
|
|
5
|
-
import {
|
|
6
|
-
__esm,
|
|
7
|
-
__export
|
|
8
|
-
} from "./roy-agent-core-fs0mn2jk.js";
|
|
9
|
-
|
|
10
|
-
// src/env/workflow/nodes/condition-node.ts
|
|
11
|
-
class ConditionNode {
|
|
12
|
-
definition;
|
|
13
|
-
type = "condition";
|
|
14
|
-
id;
|
|
15
|
-
constructor(definition) {
|
|
16
|
-
this.definition = definition;
|
|
17
|
-
this.id = definition.id;
|
|
18
|
-
}
|
|
19
|
-
async execute(context) {
|
|
20
|
-
const startTime = Date.now();
|
|
21
|
-
try {
|
|
22
|
-
const conditionConfig = this.definition.config?.condition;
|
|
23
|
-
if (conditionConfig === undefined) {
|
|
24
|
-
return {
|
|
25
|
-
output: { success: true, condition: true },
|
|
26
|
-
error: undefined,
|
|
27
|
-
durationMs: Date.now() - startTime
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const resolvedCondition = this.resolveCondition(conditionConfig, context);
|
|
31
|
-
const result = this.evaluateCondition(resolvedCondition);
|
|
32
|
-
return {
|
|
33
|
-
output: { success: result, condition: resolvedCondition },
|
|
34
|
-
error: undefined,
|
|
35
|
-
durationMs: Date.now() - startTime
|
|
36
|
-
};
|
|
37
|
-
} catch (error) {
|
|
38
|
-
return {
|
|
39
|
-
output: undefined,
|
|
40
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
41
|
-
durationMs: Date.now() - startTime
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
resolveCondition(condition, context) {
|
|
46
|
-
if (typeof condition === "string") {
|
|
47
|
-
const templateMatch = condition.match(/^\{\{([^}]+)\}\}$/);
|
|
48
|
-
if (templateMatch) {
|
|
49
|
-
const path = templateMatch[1].trim();
|
|
50
|
-
return this.resolveTemplate(path, context);
|
|
51
|
-
}
|
|
52
|
-
if (condition === "true")
|
|
53
|
-
return true;
|
|
54
|
-
if (condition === "false")
|
|
55
|
-
return false;
|
|
56
|
-
return condition;
|
|
57
|
-
}
|
|
58
|
-
return condition;
|
|
59
|
-
}
|
|
60
|
-
resolveTemplate(path, context) {
|
|
61
|
-
const trimmed = path.trim();
|
|
62
|
-
if (trimmed.startsWith("input.")) {
|
|
63
|
-
const key = trimmed.slice(6);
|
|
64
|
-
return context.input?.[key];
|
|
65
|
-
}
|
|
66
|
-
if (trimmed.startsWith("nodes.")) {
|
|
67
|
-
const rest = trimmed.slice(6);
|
|
68
|
-
const segments2 = rest.split(".");
|
|
69
|
-
const nodeId2 = segments2[0];
|
|
70
|
-
let nodeOutput2 = context.previousOutputs.get(nodeId2);
|
|
71
|
-
if (nodeOutput2 === undefined) {
|
|
72
|
-
const normalizedUnderscore = nodeId2.replace(/-/g, "_");
|
|
73
|
-
const normalizedHyphen = nodeId2.replace(/_/g, "-");
|
|
74
|
-
if (normalizedUnderscore !== nodeId2) {
|
|
75
|
-
nodeOutput2 = context.previousOutputs.get(normalizedUnderscore);
|
|
76
|
-
}
|
|
77
|
-
if (nodeOutput2 === undefined && normalizedHyphen !== nodeId2) {
|
|
78
|
-
nodeOutput2 = context.previousOutputs.get(normalizedHyphen);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (nodeOutput2 === undefined)
|
|
82
|
-
return;
|
|
83
|
-
let value2 = nodeOutput2;
|
|
84
|
-
for (const segment of segments2.slice(1)) {
|
|
85
|
-
if (value2 && typeof value2 === "object") {
|
|
86
|
-
value2 = value2[segment];
|
|
87
|
-
} else {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return value2;
|
|
92
|
-
}
|
|
93
|
-
const segments = trimmed.split(".");
|
|
94
|
-
const nodeId = segments[0];
|
|
95
|
-
let nodeOutput = context.previousOutputs.get(nodeId);
|
|
96
|
-
if (nodeOutput === undefined) {
|
|
97
|
-
const normalizedUnderscore = nodeId.replace(/-/g, "_");
|
|
98
|
-
const normalizedHyphen = nodeId.replace(/_/g, "-");
|
|
99
|
-
if (normalizedUnderscore !== nodeId) {
|
|
100
|
-
nodeOutput = context.previousOutputs.get(normalizedUnderscore);
|
|
101
|
-
}
|
|
102
|
-
if (nodeOutput === undefined && normalizedHyphen !== nodeId) {
|
|
103
|
-
nodeOutput = context.previousOutputs.get(normalizedHyphen);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (nodeOutput === undefined)
|
|
107
|
-
return;
|
|
108
|
-
let value = nodeOutput;
|
|
109
|
-
for (const segment of segments.slice(1)) {
|
|
110
|
-
if (value && typeof value === "object") {
|
|
111
|
-
value = value[segment];
|
|
112
|
-
} else {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return value;
|
|
117
|
-
}
|
|
118
|
-
evaluateCondition(value) {
|
|
119
|
-
if (typeof value === "boolean") {
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
if (typeof value === "string") {
|
|
123
|
-
return value.toLowerCase() === "true" || value === "1";
|
|
124
|
-
}
|
|
125
|
-
if (typeof value === "number") {
|
|
126
|
-
return value !== 0;
|
|
127
|
-
}
|
|
128
|
-
if (value === null || value === undefined) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
if (typeof value === "object") {
|
|
132
|
-
const obj = value;
|
|
133
|
-
if ("success" in obj) {
|
|
134
|
-
return Boolean(obj.success);
|
|
135
|
-
}
|
|
136
|
-
return Object.keys(obj).length > 0;
|
|
137
|
-
}
|
|
138
|
-
return Boolean(value);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
var init_condition_node = () => {};
|
|
142
|
-
|
|
143
|
-
// src/env/workflow/nodes/merge-node.ts
|
|
144
|
-
class MergeNode {
|
|
145
|
-
definition;
|
|
146
|
-
type = "merge";
|
|
147
|
-
id;
|
|
148
|
-
constructor(definition) {
|
|
149
|
-
this.definition = definition;
|
|
150
|
-
this.id = definition.id;
|
|
151
|
-
}
|
|
152
|
-
async execute(context) {
|
|
153
|
-
const startTime = Date.now();
|
|
154
|
-
try {
|
|
155
|
-
const strategy = this.definition.config?.strategy || "collect";
|
|
156
|
-
const deps = this.definition.depends_on || [];
|
|
157
|
-
const outputs = {};
|
|
158
|
-
for (const depId of deps) {
|
|
159
|
-
let output = context.previousOutputs.get(depId);
|
|
160
|
-
if (output === undefined) {
|
|
161
|
-
const normalizedUnderscore = depId.replace(/-/g, "_");
|
|
162
|
-
const normalizedHyphen = depId.replace(/_/g, "-");
|
|
163
|
-
if (normalizedUnderscore !== depId) {
|
|
164
|
-
output = context.previousOutputs.get(normalizedUnderscore);
|
|
165
|
-
}
|
|
166
|
-
if (output === undefined && normalizedHyphen !== depId) {
|
|
167
|
-
output = context.previousOutputs.get(normalizedHyphen);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (output !== undefined) {
|
|
171
|
-
outputs[depId] = output;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
let result;
|
|
175
|
-
switch (strategy) {
|
|
176
|
-
case "collect":
|
|
177
|
-
result = outputs;
|
|
178
|
-
break;
|
|
179
|
-
case "first":
|
|
180
|
-
const firstKey = Object.keys(outputs)[0];
|
|
181
|
-
result = firstKey ? outputs[firstKey] : undefined;
|
|
182
|
-
break;
|
|
183
|
-
case "last":
|
|
184
|
-
const lastKey = Object.keys(outputs).pop();
|
|
185
|
-
result = lastKey ? outputs[lastKey] : undefined;
|
|
186
|
-
break;
|
|
187
|
-
case "merge":
|
|
188
|
-
result = this.deepMerge(Object.values(outputs));
|
|
189
|
-
break;
|
|
190
|
-
default:
|
|
191
|
-
result = outputs;
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
output: {
|
|
195
|
-
strategy,
|
|
196
|
-
results: result,
|
|
197
|
-
count: Object.keys(outputs).length
|
|
198
|
-
},
|
|
199
|
-
error: undefined,
|
|
200
|
-
durationMs: Date.now() - startTime
|
|
201
|
-
};
|
|
202
|
-
} catch (error) {
|
|
203
|
-
return {
|
|
204
|
-
output: undefined,
|
|
205
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
206
|
-
durationMs: Date.now() - startTime
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
deepMerge(objects) {
|
|
211
|
-
const result = {};
|
|
212
|
-
for (const obj of objects) {
|
|
213
|
-
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
|
214
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
215
|
-
if (result[key] && typeof result[key] === "object" && !Array.isArray(result[key]) && value && typeof value === "object" && !Array.isArray(value)) {
|
|
216
|
-
result[key] = this.deepMerge([result[key], value]);
|
|
217
|
-
} else {
|
|
218
|
-
result[key] = value;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
var init_merge_node = () => {};
|
|
227
|
-
|
|
228
|
-
// src/env/workflow/utils/node-registry-helper.ts
|
|
229
|
-
var exports_node_registry_helper = {};
|
|
230
|
-
__export(exports_node_registry_helper, {
|
|
231
|
-
registerDecoratorNodeType: () => registerDecoratorNodeType,
|
|
232
|
-
hasDecoratorNodes: () => hasDecoratorNodes,
|
|
233
|
-
getDecoratorNodes: () => getDecoratorNodes
|
|
234
|
-
});
|
|
235
|
-
function registerDecoratorNodeType(registry) {
|
|
236
|
-
registry.register("decorator", (definition) => {
|
|
237
|
-
return new DecoratorNode(definition);
|
|
238
|
-
});
|
|
239
|
-
registry.register("condition", (definition) => {
|
|
240
|
-
return new ConditionNode(definition);
|
|
241
|
-
});
|
|
242
|
-
registry.register("merge", (definition) => {
|
|
243
|
-
return new MergeNode(definition);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
function hasDecoratorNodes(nodes) {
|
|
247
|
-
return nodes.some((node) => node.type === "decorator");
|
|
248
|
-
}
|
|
249
|
-
function getDecoratorNodes(nodes) {
|
|
250
|
-
return nodes.filter((node) => node.type === "decorator");
|
|
251
|
-
}
|
|
252
|
-
var init_node_registry_helper = __esm(() => {
|
|
253
|
-
init_decorator_node();
|
|
254
|
-
init_condition_node();
|
|
255
|
-
init_merge_node();
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
export { registerDecoratorNodeType, hasDecoratorNodes, getDecoratorNodes, exports_node_registry_helper, init_node_registry_helper };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AskUserError,
|
|
3
|
-
init_workflow_hil
|
|
4
|
-
} from "./roy-agent-core-e25xkv53.js";
|
|
5
|
-
|
|
6
|
-
// src/env/workflow/tools/ask-user-tool.ts
|
|
7
|
-
init_workflow_hil();
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
var AskUserInputSchema = z.object({
|
|
10
|
-
query: z.string().describe("The question or request to ask the user"),
|
|
11
|
-
options: z.array(z.string()).optional().describe("Optional choices for the user"),
|
|
12
|
-
required_confirm: z.boolean().optional().describe("If true, user must explicitly confirm")
|
|
13
|
-
});
|
|
14
|
-
var askUserTool = {
|
|
15
|
-
name: "ask_user",
|
|
16
|
-
description: "Ask user for input or confirmation. Use this tool when you need user input or validation to continue the workflow.",
|
|
17
|
-
parameters: AskUserInputSchema,
|
|
18
|
-
async execute(args, context) {
|
|
19
|
-
const runId = context.metadata?.runId || "unknown";
|
|
20
|
-
const sessionId = context.metadata?.sessionId || `workflow_${runId}`;
|
|
21
|
-
const nodeId = context.metadata?.nodeId || "unknown";
|
|
22
|
-
let fullQuery = args.query;
|
|
23
|
-
if (args.options && args.options.length > 0) {
|
|
24
|
-
fullQuery = `${args.query} (选项: ${args.options.join(", ")})`;
|
|
25
|
-
}
|
|
26
|
-
throw new AskUserError(runId, sessionId, nodeId, "agent", fullQuery);
|
|
27
|
-
},
|
|
28
|
-
metadata: {
|
|
29
|
-
category: "workflow",
|
|
30
|
-
tags: ["human-in-loop", "user-input"],
|
|
31
|
-
version: "1.0.0"
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var askUserToolInstance = askUserTool;
|
|
35
|
-
|
|
36
|
-
export { AskUserInputSchema, askUserTool, askUserToolInstance };
|