@ai-setting/roy-agent-core 1.5.15-test → 1.5.16-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.
Files changed (141) hide show
  1. package/dist/config/index.d.ts +1250 -0
  2. package/dist/config/index.js +32 -0
  3. package/dist/env/agent/index.d.ts +2279 -0
  4. package/dist/env/agent/index.js +24 -0
  5. package/dist/env/commands/index.d.ts +1131 -0
  6. package/dist/env/commands/index.js +14 -0
  7. package/dist/env/debug/formatters/index.d.ts +236 -0
  8. package/dist/env/debug/formatters/index.js +11 -0
  9. package/dist/env/debug/index.d.ts +1652 -0
  10. package/dist/env/debug/index.js +26 -0
  11. package/dist/env/hook/index.d.ts +279 -0
  12. package/dist/env/hook/index.js +29 -0
  13. package/dist/env/index.d.ts +3481 -0
  14. package/dist/env/index.js +82 -0
  15. package/dist/env/llm/index.d.ts +1760 -0
  16. package/dist/env/llm/index.js +40 -0
  17. package/dist/env/log-trace/index.d.ts +1574 -0
  18. package/dist/env/log-trace/index.js +83 -0
  19. package/dist/env/mcp/index.d.ts +1331 -0
  20. package/dist/env/mcp/index.js +39 -0
  21. package/dist/env/mcp/tool/index.d.ts +183 -0
  22. package/dist/env/mcp/tool/index.js +14 -0
  23. package/dist/env/memory/built-in/index.d.ts +232 -0
  24. package/dist/env/memory/built-in/index.js +11 -0
  25. package/dist/env/memory/index.d.ts +1799 -0
  26. package/dist/env/memory/index.js +56 -0
  27. package/dist/env/memory/plugin/index.d.ts +747 -0
  28. package/dist/env/memory/plugin/index.js +36 -0
  29. package/dist/env/prompt/index.d.ts +1164 -0
  30. package/dist/env/prompt/index.js +20 -0
  31. package/dist/env/session/index.d.ts +1908 -0
  32. package/dist/env/session/index.js +25 -0
  33. package/dist/env/session/storage/index.d.ts +564 -0
  34. package/dist/env/session/storage/index.js +18 -0
  35. package/dist/env/skill/index.d.ts +1266 -0
  36. package/dist/env/skill/index.js +34 -0
  37. package/dist/env/skill/tool/index.d.ts +193 -0
  38. package/dist/env/skill/tool/index.js +9 -0
  39. package/dist/env/task/delegate/index.d.ts +1612 -0
  40. package/dist/env/task/delegate/index.js +18 -0
  41. package/dist/env/task/events/index.d.ts +171 -0
  42. package/dist/env/task/events/index.js +7 -0
  43. package/dist/env/task/hooks/index.d.ts +624 -0
  44. package/dist/env/task/hooks/index.js +7 -0
  45. package/dist/env/task/index.d.ts +1553 -0
  46. package/dist/env/task/index.js +34 -0
  47. package/dist/env/task/plugins/index.d.ts +466 -0
  48. package/dist/env/task/plugins/index.js +23 -0
  49. package/dist/env/task/storage/index.d.ts +241 -0
  50. package/dist/env/task/storage/index.js +14 -0
  51. package/dist/env/task/tools/index.d.ts +1485 -0
  52. package/dist/env/task/tools/index.js +17 -0
  53. package/dist/env/task/tools/operation/index.d.ts +1484 -0
  54. package/dist/env/task/tools/operation/index.js +15 -0
  55. package/dist/env/tool/built-in/index.d.ts +218 -0
  56. package/dist/env/tool/built-in/index.js +25 -0
  57. package/dist/env/tool/index.d.ts +1396 -0
  58. package/dist/env/tool/index.js +39 -0
  59. package/dist/env/workflow/decorators/index.d.ts +2161 -0
  60. package/dist/env/workflow/decorators/index.js +27 -0
  61. package/dist/env/workflow/engine/index.d.ts +3453 -0
  62. package/dist/env/workflow/engine/index.js +28 -0
  63. package/dist/env/workflow/index.d.ts +3546 -0
  64. package/dist/env/workflow/index.js +136 -0
  65. package/dist/env/workflow/nodes/index.d.ts +2092 -0
  66. package/dist/env/workflow/nodes/index.js +19 -0
  67. package/dist/env/workflow/service/index.d.ts +227 -0
  68. package/dist/env/workflow/service/index.js +13 -0
  69. package/dist/env/workflow/storage/index.d.ts +165 -0
  70. package/dist/env/workflow/storage/index.js +27 -0
  71. package/dist/env/workflow/tools/index.d.ts +416 -0
  72. package/dist/env/workflow/tools/index.js +159 -0
  73. package/dist/env/workflow/types/index.d.ts +2255 -0
  74. package/dist/env/workflow/types/index.js +98 -0
  75. package/dist/env/workflow/utils/index.d.ts +2031 -0
  76. package/dist/env/workflow/utils/index.js +637 -0
  77. package/dist/index.d.ts +7858 -0
  78. package/dist/index.js +399 -0
  79. package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +258 -0
  80. package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +36 -0
  81. package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +349 -0
  82. package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +117 -0
  83. package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +11 -0
  84. package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +393 -0
  85. package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +200 -0
  86. package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +299 -0
  87. package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +206 -0
  88. package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +393 -0
  89. package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +350 -0
  90. package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +180 -0
  91. package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +408 -0
  92. package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +284 -0
  93. package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +762 -0
  94. package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +10 -0
  95. package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +14 -0
  96. package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +922 -0
  97. package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +15 -0
  98. package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +1130 -0
  99. package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +14 -0
  100. package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +653 -0
  101. package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +93 -0
  102. package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +872 -0
  103. package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +11 -0
  104. package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +64 -0
  105. package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +378 -0
  106. package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +492 -0
  107. package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +52 -0
  108. package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +171 -0
  109. package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +862 -0
  110. package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +1387 -0
  111. package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +208 -0
  112. package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +139 -0
  113. package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +534 -0
  114. package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +204 -0
  115. package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +603 -0
  116. package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +97 -0
  117. package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +587 -0
  118. package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +176 -0
  119. package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +60 -0
  120. package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +442 -0
  121. package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +57 -0
  122. package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +66 -0
  123. package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +10 -0
  124. package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +267 -0
  125. package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +584 -0
  126. package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +102 -0
  127. package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +549 -0
  128. package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +15 -0
  129. package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +213 -0
  130. package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +812 -0
  131. package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +1316 -0
  132. package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +1205 -0
  133. package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +328 -0
  134. package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +20 -0
  135. package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +2098 -0
  136. package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +419 -0
  137. package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +368 -0
  138. package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +377 -0
  139. package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +172 -0
  140. package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +103 -0
  141. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ import {
2
+ DebugComponent,
3
+ LogReader,
4
+ RegexParser,
5
+ SpanBuilder,
6
+ SpanDbReader
7
+ } from "../../shared/@ai-setting/roy-agent-core-g99pxzn5.js";
8
+ import {
9
+ ReplFormatter,
10
+ TraceFormatter,
11
+ TreeFormatter
12
+ } from "../../shared/@ai-setting/roy-agent-core-rvv6ydff.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-kkbwepqb.js";
14
+ import"../../shared/@ai-setting/roy-agent-core-2dhd60aw.js";
15
+ import"../../shared/@ai-setting/roy-agent-core-gjq1yk68.js";
16
+ import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
17
+ export {
18
+ TreeFormatter,
19
+ TraceFormatter,
20
+ SpanDbReader,
21
+ SpanBuilder,
22
+ ReplFormatter,
23
+ RegexParser,
24
+ LogReader,
25
+ DebugComponent
26
+ };
@@ -0,0 +1,279 @@
1
+ /**
2
+ * @fileoverview Hook 系统统一类型定义
3
+ *
4
+ * 提供所有 Component 使用的统一 Hook 接口
5
+ */
6
+ /**
7
+ * Hook 执行阶段
8
+ */
9
+ type HookPhase = "before" | "after" | "error";
10
+ /**
11
+ * Hook 元信息
12
+ */
13
+ interface HookMeta {
14
+ /** Hook 唯一名称 */
15
+ name: string;
16
+ /** 执行优先级,默认 0,数值越小越先执行 */
17
+ priority?: number;
18
+ /** 描述 */
19
+ description?: string;
20
+ }
21
+ /**
22
+ * 统一 Hook 上下文
23
+ *
24
+ * 泛型参数 T 表示该 Component 的上下文数据类型
25
+ */
26
+ interface HookContext<T = unknown> {
27
+ /** 当前组件信息 */
28
+ component: {
29
+ /** 组件名称 */
30
+ name: string;
31
+ /** 组件版本 */
32
+ version: string;
33
+ };
34
+ /** 上下文数据(Component 特定) */
35
+ data: T;
36
+ /** 元数据(可用于传递额外信息) */
37
+ metadata: Record<string, unknown>;
38
+ /** 执行阶段 */
39
+ phase: HookPhase;
40
+ /** 关联的 hook 点名称 */
41
+ hookPoint: string;
42
+ }
43
+ /**
44
+ * 统一 Hook 接口
45
+ *
46
+ * 所有 Component 的 Hook 都应实现此接口
47
+ */
48
+ interface Hook<T = unknown> extends HookMeta {
49
+ /** 执行 Hook
50
+ * @param ctx 上下文
51
+ */
52
+ execute(ctx: HookContext<T>): void | Promise<void>;
53
+ }
54
+ /**
55
+ * Hook 函数类型(便捷别名)
56
+ */
57
+ type HookFn<T = unknown> = (ctx: HookContext<T>) => void | Promise<void>;
58
+ /**
59
+ * Hook 干预动作类型
60
+ */
61
+ type HookActionType = "stop" | "retry" | "compress" | "extract_memory" | "inject_message" | "skip_tool" | "custom";
62
+ /**
63
+ * Hook 干预动作
64
+ */
65
+ interface HookAction {
66
+ /** 动作类型 */
67
+ type: HookActionType;
68
+ /** 动作参数 */
69
+ params?: Record<string, unknown>;
70
+ /** 动作描述 */
71
+ description?: string;
72
+ }
73
+ /**
74
+ * Hook 执行结果
75
+ */
76
+ interface HookResult {
77
+ /** 是否被停止 */
78
+ stopped?: boolean;
79
+ /** 干预动作(如果有) */
80
+ action?: HookAction;
81
+ /** 执行结果数据 */
82
+ results?: unknown[];
83
+ }
84
+ /**
85
+ * 创建 Hook 的工厂函数
86
+ *
87
+ * @param meta Hook 元信息
88
+ * @param fn 执行函数
89
+ * @returns Hook 实例
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const hook = createHook(
94
+ * { name: "my-hook", priority: 10 },
95
+ * async (ctx) => { console.log(ctx.data); }
96
+ * );
97
+ * ```
98
+ */
99
+ declare function createHook<T = unknown>(meta: HookMeta, fn: HookFn<T>): Hook<T>;
100
+ /**
101
+ * 创建带优先级的 Hook 的便捷函数
102
+ */
103
+ declare function createPriorityHook<T = unknown>(name: string, fn: HookFn<T>, priority: number): Hook<T>;
104
+ /**
105
+ * HookManager 配置
106
+ */
107
+ interface HookManagerOptions {
108
+ /** 组件名称(用于上下文) */
109
+ componentName?: string;
110
+ /** 组件版本(用于上下文) */
111
+ componentVersion?: string;
112
+ /** 默认优先级 */
113
+ defaultPriority?: number;
114
+ }
115
+ /**
116
+ * HookManager
117
+ *
118
+ * 统一管理 Component 的 Hook
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const manager = new HookManager<MyContext>();
123
+ *
124
+ * // 注册 Hook
125
+ * manager.register("before-action", {
126
+ * name: "my-hook",
127
+ * priority: 10,
128
+ * execute: async (ctx) => { /* ... *\/ }
129
+ * });
130
+ *
131
+ * // 执行 Hooks
132
+ * await manager.execute("before-action", data);
133
+ * ```
134
+ */
135
+ declare class HookManager<T = unknown> {
136
+ private _hooks;
137
+ private componentName;
138
+ private componentVersion;
139
+ private defaultPriority;
140
+ constructor(options?: HookManagerOptions);
141
+ /**
142
+ * 注册 Hook 到指定 hook 点
143
+ */
144
+ register(hookPoint: string, hook: Hook<T>): void;
145
+ /**
146
+ * 注册多个 Hook
147
+ */
148
+ registerMany(hookPoint: string, hooks: Hook<T>[]): void;
149
+ /**
150
+ * 按名称取消注册 Hook
151
+ * @returns 是否成功取消注册
152
+ */
153
+ unregister(hookPoint: string, name: string): boolean;
154
+ /**
155
+ * 取消注册所有指定 hook 点的 Hook
156
+ */
157
+ unregisterAll(hookPoint: string): void;
158
+ /**
159
+ * 执行指定 hook 点的所有 Hook
160
+ */
161
+ execute(hookPoint: string, data: T, metadata?: Record<string, unknown>): Promise<void>;
162
+ /**
163
+ * 执行指定 hook 点的所有 Hook 并收集返回值
164
+ */
165
+ executeAndCollect<R>(hookPoint: string, data: T, metadata?: Record<string, unknown>): Promise<R[]>;
166
+ /**
167
+ * 获取指定 hook 点的 Hook 数量
168
+ */
169
+ count(hookPoint: string): number;
170
+ /**
171
+ * 清空所有 Hook
172
+ */
173
+ clear(): void;
174
+ /**
175
+ * 获取所有已注册的 hook 点
176
+ */
177
+ getHookPoints(): string[];
178
+ /**
179
+ * 检查 hook 点是否有任何 Hook
180
+ */
181
+ hasHooks(hookPoint: string): boolean;
182
+ /**
183
+ * 设置组件信息
184
+ */
185
+ setComponentInfo(name: string, version: string): void;
186
+ /**
187
+ * 获取所有注册的 hooks(只读副本)
188
+ */
189
+ get hooks(): ReadonlyMap<string, Hook<T>[]>;
190
+ /**
191
+ * 执行 Hook 并支持干预机制
192
+ *
193
+ * 如果任何一个 Hook 返回 { stop: true },执行会停止
194
+ * Hook 可以通过返回 HookResult 来执行干预动作
195
+ *
196
+ * @param hookPoint Hook 点
197
+ * @param data 数据
198
+ * @param metadata 元数据
199
+ * @returns 执行结果
200
+ */
201
+ executeWithIntervention(hookPoint: string, data: T, metadata?: Record<string, unknown>): Promise<HookResult>;
202
+ /**
203
+ * 获取或创建 hook 列表
204
+ */
205
+ private getOrCreateHooks;
206
+ /**
207
+ * 按优先级排序 Hook
208
+ *
209
+ * 优先级相同时保持原顺序(稳定排序)
210
+ */
211
+ private sortHooks;
212
+ /**
213
+ * 创建 Hook 上下文
214
+ */
215
+ private createContext;
216
+ /**
217
+ * 安全执行 Hook(错误隔离)
218
+ */
219
+ private safeExecute;
220
+ /**
221
+ * 安全执行 Hook 并返回结果
222
+ */
223
+ private safeExecuteAndReturn;
224
+ }
225
+ /**
226
+ * 全局 HookManager 实例
227
+ *
228
+ * 所有 Agent/LLM/Tool hooks 都注册到这个实例
229
+ */
230
+ declare const globalHookManager: unknown;
231
+ /**
232
+ * Agent Hook 点(新版统一命名)
233
+ */
234
+ declare const AgentHookPoints: {
235
+ readonly BEFORE_START: "agent:before.start";
236
+ readonly BEFORE_LLM: "agent:before.llm";
237
+ readonly AFTER_LLM: "agent:after.llm";
238
+ readonly BEFORE_TOOL: "agent:before.tool";
239
+ readonly AFTER_TOOL: "agent:after.tool";
240
+ readonly ON_ITERATION: "agent:on.iteration";
241
+ readonly ON_THRESHOLD: "agent:on.threshold";
242
+ readonly AFTER_COMPLETE: "agent:after.complete";
243
+ readonly ON_ERROR: "agent:on.error";
244
+ };
245
+ /**
246
+ * LLM Hook 点
247
+ */
248
+ declare const LLMHookPoints: {
249
+ readonly BEFORE_INVOKE: "llm:before.invoke";
250
+ readonly AFTER_INVOKE: "llm:after.invoke";
251
+ readonly ON_STREAM: "llm:on.stream";
252
+ };
253
+ /**
254
+ * Tool Hook 点
255
+ */
256
+ declare const ToolHookPoints: {
257
+ readonly BEFORE_EXECUTE: "tool:before.execute";
258
+ readonly AFTER_EXECUTE: "tool:after.execute";
259
+ readonly BEFORE_REGISTER: "tool:before.register";
260
+ readonly AFTER_REGISTER: "tool:after.register";
261
+ readonly ON_ERROR: "tool:on.error";
262
+ };
263
+ /**
264
+ * 执行 Agent Hook(不带干预)
265
+ */
266
+ declare function executeAgentHook(hookPoint: string, data: unknown, metadata?: Record<string, unknown>): Promise<void>;
267
+ /**
268
+ * 执行 Agent Hook(带干预检查)
269
+ */
270
+ declare function executeAgentHookWithIntervention(hookPoint: string, data: unknown, metadata?: Record<string, unknown>): Promise<HookResult>;
271
+ /**
272
+ * 执行 LLM Hook(不带干预)
273
+ */
274
+ declare function executeLLMHook(hookPoint: string, data: unknown, metadata?: Record<string, unknown>): Promise<void>;
275
+ /**
276
+ * 执行 Tool Hook(不带干预)
277
+ */
278
+ declare function executeToolHook(hookPoint: string, data: unknown, metadata?: Record<string, unknown>): Promise<void>;
279
+ export { globalHookManager, executeToolHook, executeLLMHook, executeAgentHookWithIntervention, executeAgentHook, createPriorityHook, createHook, ToolHookPoints, LLMHookPoints, HookResult, HookPhase, HookMeta, HookManagerOptions, HookManager, HookFn, HookContext, HookActionType, HookAction, Hook, HookFn as BaseHookFn, HookContext as BaseHookContext, Hook as BaseHook, AgentHookPoints };
@@ -0,0 +1,29 @@
1
+ import {
2
+ createHook,
3
+ createPriorityHook
4
+ } from "../../shared/@ai-setting/roy-agent-core-2dhd60aw.js";
5
+ import {
6
+ AgentHookPoints,
7
+ HookManager,
8
+ LLMHookPoints,
9
+ ToolHookPoints,
10
+ executeAgentHook,
11
+ executeAgentHookWithIntervention,
12
+ executeLLMHook,
13
+ executeToolHook,
14
+ globalHookManager
15
+ } from "../../shared/@ai-setting/roy-agent-core-gjq1yk68.js";
16
+ import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
17
+ export {
18
+ globalHookManager,
19
+ executeToolHook,
20
+ executeLLMHook,
21
+ executeAgentHookWithIntervention,
22
+ executeAgentHook,
23
+ createPriorityHook,
24
+ createHook,
25
+ ToolHookPoints,
26
+ LLMHookPoints,
27
+ HookManager,
28
+ AgentHookPoints
29
+ };