@ai-setting/roy-agent-core 1.5.16-test → 1.5.22

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 (54) hide show
  1. package/dist/env/index.js +20 -8
  2. package/dist/env/log-trace/index.js +1 -1
  3. package/dist/env/prompt/index.js +1 -1
  4. package/dist/env/workflow/engine/index.js +1 -1
  5. package/dist/env/workflow/index.js +2 -2
  6. package/dist/index.js +6 -7
  7. package/dist/shared/@ai-setting/{roy-agent-core-xq8hhqb8.js → roy-agent-core-4wjywp3c.js} +4 -2
  8. package/dist/shared/@ai-setting/roy-agent-core-8jxva565.js +19 -0
  9. package/dist/shared/@ai-setting/roy-agent-core-avq1x4t7.js +84 -0
  10. package/dist/shared/@ai-setting/{roy-agent-core-gq20wsgv.js → roy-agent-core-ffb9fq4v.js} +23 -2
  11. package/dist/shared/@ai-setting/{roy-agent-core-93zfb3r1.js → roy-agent-core-mrcxzpbg.js} +1 -1
  12. package/dist/shared/@ai-setting/{roy-agent-core-rhmtwnw1.js → roy-agent-core-pw7cv1px.js} +1 -1
  13. package/dist/shared/@ai-setting/{roy-agent-core-gbqcyegm.js → roy-agent-core-rccptwv0.js} +512 -673
  14. package/dist/shared/@ai-setting/{roy-agent-core-wrcy0h6z.js → roy-agent-core-ty94k28r.js} +1 -1
  15. package/package.json +1 -1
  16. package/dist/config/index.d.ts +0 -1250
  17. package/dist/env/agent/index.d.ts +0 -2279
  18. package/dist/env/commands/index.d.ts +0 -1131
  19. package/dist/env/debug/formatters/index.d.ts +0 -236
  20. package/dist/env/debug/index.d.ts +0 -1652
  21. package/dist/env/hook/index.d.ts +0 -279
  22. package/dist/env/index.d.ts +0 -3481
  23. package/dist/env/llm/index.d.ts +0 -1760
  24. package/dist/env/log-trace/index.d.ts +0 -1574
  25. package/dist/env/mcp/index.d.ts +0 -1331
  26. package/dist/env/mcp/tool/index.d.ts +0 -183
  27. package/dist/env/memory/built-in/index.d.ts +0 -232
  28. package/dist/env/memory/index.d.ts +0 -1799
  29. package/dist/env/memory/plugin/index.d.ts +0 -747
  30. package/dist/env/prompt/index.d.ts +0 -1164
  31. package/dist/env/session/index.d.ts +0 -1908
  32. package/dist/env/session/storage/index.d.ts +0 -564
  33. package/dist/env/skill/index.d.ts +0 -1266
  34. package/dist/env/skill/tool/index.d.ts +0 -193
  35. package/dist/env/task/delegate/index.d.ts +0 -1612
  36. package/dist/env/task/events/index.d.ts +0 -171
  37. package/dist/env/task/hooks/index.d.ts +0 -624
  38. package/dist/env/task/index.d.ts +0 -1553
  39. package/dist/env/task/plugins/index.d.ts +0 -466
  40. package/dist/env/task/storage/index.d.ts +0 -241
  41. package/dist/env/task/tools/index.d.ts +0 -1485
  42. package/dist/env/task/tools/operation/index.d.ts +0 -1484
  43. package/dist/env/tool/built-in/index.d.ts +0 -218
  44. package/dist/env/tool/index.d.ts +0 -1396
  45. package/dist/env/workflow/decorators/index.d.ts +0 -2161
  46. package/dist/env/workflow/engine/index.d.ts +0 -3453
  47. package/dist/env/workflow/index.d.ts +0 -3546
  48. package/dist/env/workflow/nodes/index.d.ts +0 -2092
  49. package/dist/env/workflow/service/index.d.ts +0 -227
  50. package/dist/env/workflow/storage/index.d.ts +0 -165
  51. package/dist/env/workflow/tools/index.d.ts +0 -416
  52. package/dist/env/workflow/types/index.d.ts +0 -2255
  53. package/dist/env/workflow/utils/index.d.ts +0 -2031
  54. package/dist/index.d.ts +0 -7858
@@ -1,416 +0,0 @@
1
- import { z as z5 } from "zod";
2
- import { z as z4 } from "zod";
3
- import { z as z2, ZodType, ZodError } from "zod";
4
- /**
5
- * 沙箱配置
6
- */
7
- interface SandboxConfig {
8
- /** 是否启用沙箱 */
9
- enabled: boolean;
10
- /** 沙箱类型 */
11
- type: "native" | "docker";
12
- /** 动作过滤 */
13
- actionFilter?: {
14
- /** 包含的动作 */
15
- include?: string[];
16
- /** 排除的动作 */
17
- exclude?: string[];
18
- };
19
- /** 文件系统限制 */
20
- filesystem?: {
21
- /** 允许读取 */
22
- allowRead?: string[];
23
- /** 禁止读取 */
24
- denyRead?: string[];
25
- /** 允许写入 */
26
- allowWrite?: string[];
27
- /** 禁止写入 */
28
- denyWrite?: string[];
29
- };
30
- /** 网络限制 */
31
- network?: {
32
- /** 允许的域名 */
33
- allowedDomains?: string[];
34
- /** 禁止的域名 */
35
- deniedDomains?: string[];
36
- };
37
- /** Docker 配置 */
38
- docker?: {
39
- /** 镜像 */
40
- image?: string;
41
- /** 网络模式 */
42
- networkMode?: "bridge" | "host" | "none";
43
- /** 卷挂载 */
44
- volumes?: Record<string, string>;
45
- };
46
- }
47
- /**
48
- * 工具执行上下文
49
- */
50
- interface ToolContext {
51
- /** 工作目录 */
52
- workdir?: string;
53
- /** 用户 ID */
54
- user_id?: string;
55
- /** 会话 ID */
56
- session_id?: string;
57
- /** 消息 ID */
58
- message_id?: string;
59
- /** 中断信号 */
60
- abort?: AbortSignal;
61
- /** 额外元数据 */
62
- metadata?: Record<string, unknown>;
63
- /** 沙箱配置 */
64
- sandbox?: SandboxConfig;
65
- /** 沙箱 Provider */
66
- sandboxProvider?: unknown | null;
67
- }
68
- /**
69
- * 工具结果元数据
70
- */
71
- interface ToolResultMetadata {
72
- /** 执行时间(毫秒) */
73
- execution_time_ms: number;
74
- /** 输出大小(字节) */
75
- output_size?: number;
76
- /** 标准输出 */
77
- stdout?: string;
78
- /** 标准错误 */
79
- stderr?: string;
80
- /** 退出码 */
81
- exit_code?: number;
82
- /** Token 使用量 */
83
- usage?: {
84
- inputTokens: number;
85
- outputTokens: number;
86
- totalTokens?: number;
87
- };
88
- /** 额外元数据 */
89
- [key: string]: unknown;
90
- }
91
- /**
92
- * 工具执行结果
93
- */
94
- interface ToolResult2 {
95
- /** 是否成功 */
96
- success: boolean;
97
- /** 输出内容 */
98
- output: string | Record<string, unknown>;
99
- /** 错误信息 */
100
- error?: string;
101
- /** 结果元数据 */
102
- metadata?: ToolResultMetadata;
103
- }
104
- /**
105
- * 工具元数据
106
- */
107
- interface ToolMetadata {
108
- /** 分类 */
109
- category?: string;
110
- /** 标签 */
111
- tags?: string[];
112
- /** 版本 */
113
- version?: string;
114
- /** 作者 */
115
- author?: string;
116
- /** 是否实验性 */
117
- experimental?: boolean;
118
- /** MCP 工具信息(MCP adapter 使用) */
119
- mcpTool?: {
120
- originalName: string;
121
- originalDescription: string;
122
- inputSchema?: unknown;
123
- };
124
- }
125
- /**
126
- * 工具沙箱配置
127
- */
128
- interface ToolSandboxConfig {
129
- /** 是否启用沙箱 */
130
- enabled: boolean;
131
- /** 沙箱配置 */
132
- config?: Partial<SandboxConfig>;
133
- }
134
- /**
135
- * 工具权限配置
136
- */
137
- interface ToolPermissionConfig {
138
- /** 是否需要用户确认 */
139
- requireConfirmation?: boolean;
140
- /** 权限级别 */
141
- level?: "safe" | "dangerous" | "critical";
142
- }
143
- /**
144
- * 工具信息
145
- */
146
- interface ToolInfo<Parameters extends ZodType = ZodType> {
147
- /** 工具名称 */
148
- name: string;
149
- /** 工具描述 */
150
- description: string;
151
- /** 参数 Schema */
152
- parameters: Parameters;
153
- /** 初始化函数(可选) */
154
- init?: (ctx?: ToolContext) => Promise<void>;
155
- /** 执行函数 */
156
- execute: (args: z2.infer<Parameters>, ctx: ToolContext) => Promise<ToolResult2>;
157
- /** 参数验证错误格式化(可选) */
158
- formatValidationError?: (error: ZodError) => string;
159
- /** 沙箱配置 */
160
- sandbox?: ToolSandboxConfig;
161
- /** 权限配置 */
162
- permission?: ToolPermissionConfig;
163
- /** 工具元数据 */
164
- metadata?: ToolMetadata;
165
- }
166
- /**
167
- * 工具类型别名
168
- */
169
- type Tool = ToolInfo;
170
- declare const RunStatusSchema: unknown;
171
- type RunStatus = z4.infer<typeof RunStatusSchema>;
172
- interface RunOptions {
173
- input?: Record<string, any>;
174
- debug?: boolean;
175
- parallelLimit?: number | null;
176
- timeout?: number | null;
177
- /** @deprecated No-op: workflow always waits for completion */
178
- sync?: boolean;
179
- }
180
- interface RunResult {
181
- runId: string;
182
- /** Session ID (workflow_{runId} format) - useful for CLI resume */
183
- sessionId?: string;
184
- status: RunStatus;
185
- output?: Record<string, any>;
186
- error?: string;
187
- durationMs?: number;
188
- /** Pending node ID (when status is 'paused') */
189
- pendingNodeId?: string;
190
- /** Query from ask_user (when status is 'paused') */
191
- query?: string;
192
- /** Agent sub-session ID (for resuming agent nodes) */
193
- agentSessionId?: string;
194
- }
195
- declare const NodeDefinitionSchema: unknown;
196
- type NodeDefinition = z5.infer<typeof NodeDefinitionSchema>;
197
- declare const WorkflowConfigSchema: unknown;
198
- type WorkflowConfig = z5.infer<typeof WorkflowConfigSchema>;
199
- declare const WorkflowMetadataSchema: unknown;
200
- type WorkflowMetadata = z5.infer<typeof WorkflowMetadataSchema>;
201
- declare const WorkflowDefinitionSchema: unknown;
202
- type WorkflowDefinition = z5.infer<typeof WorkflowDefinitionSchema>;
203
- interface Workflow {
204
- id: string;
205
- name: string;
206
- version: string;
207
- description?: string;
208
- definition: WorkflowDefinition;
209
- config: WorkflowConfig;
210
- metadata: WorkflowMetadata;
211
- tags: string[];
212
- createdAt: Date;
213
- updatedAt: Date;
214
- }
215
- import { z as z7 } from "zod";
216
- interface WorkflowRepository {
217
- create(workflow: Omit<Workflow, "id" | "createdAt" | "updatedAt">): Workflow;
218
- getById(id: string): Workflow | null;
219
- getByName(name: string): Workflow | null;
220
- list(options?: ListOptions): Workflow[];
221
- update(id: string, updates: Partial<Workflow>): Workflow | null;
222
- delete(id: string): boolean;
223
- }
224
- interface CreateOptions {
225
- tags?: string[];
226
- metadata?: WorkflowMetadata;
227
- taskId?: number;
228
- force?: boolean;
229
- }
230
- interface ListOptions {
231
- tag?: string;
232
- taskId?: number;
233
- search?: string;
234
- limit?: number;
235
- offset?: number;
236
- }
237
- interface WorkflowUpdates {
238
- definition?: WorkflowDefinition;
239
- config?: WorkflowConfig;
240
- tags?: string[];
241
- metadata?: WorkflowMetadata;
242
- }
243
- interface WorkflowEngine {
244
- createSession(workflowId: string, options?: {
245
- input?: Record<string, any>;
246
- workflowName?: string;
247
- workflowVersion?: string;
248
- }): Promise<string>;
249
- run(sessionId: string, options?: RunOptions): Promise<RunResult>;
250
- runWorkflow(workflow: Workflow | WorkflowDefinition, options?: RunOptions): Promise<RunResult>;
251
- stop(sessionId: string, reason?: string): Promise<void>;
252
- addNode(sessionId: string, nodeDefinition: NodeDefinition): Promise<void>;
253
- removeNode(sessionId: string, nodeId: string): Promise<void>;
254
- }
255
- type WorkflowEngineFactory = (workflow: Workflow, options?: RunOptions) => Pick<WorkflowEngine, "run" | "stop" | "runWorkflow">;
256
- interface SessionInfo {
257
- id: string;
258
- title: string;
259
- metadata: WorkflowSessionMetadata3;
260
- createdAt: Date;
261
- updatedAt: Date;
262
- }
263
- interface WorkflowSessionMetadata3 {
264
- type: "workflow";
265
- runId?: string;
266
- workflowId?: string;
267
- workflowName: string;
268
- workflowVersion?: string;
269
- status: "running" | "paused" | "completed" | "failed";
270
- input?: any;
271
- rootNodeId?: string;
272
- agentSessions?: AgentSessionRef3[];
273
- }
274
- interface AgentSessionRef3 {
275
- nodeId: string;
276
- sessionId: string;
277
- status: "active" | "paused" | "completed";
278
- }
279
- declare class WorkflowService {
280
- private workflowRepository;
281
- private engineFactory;
282
- private sessionComponent?;
283
- constructor(workflowRepository: WorkflowRepository, engineFactory: WorkflowEngineFactory, sessionComponent?: {
284
- create(options: {
285
- id?: string;
286
- title: string;
287
- metadata: any;
288
- }): Promise<{
289
- id: string;
290
- }>;
291
- get(id: string): Promise<SessionInfo | null | undefined>;
292
- list?(options?: {
293
- limit?: number;
294
- offset?: number;
295
- }): Promise<SessionInfo[]>;
296
- update(id: string, updates: {
297
- metadata?: any;
298
- }): Promise<boolean>;
299
- addMessage(sessionId: string, message: any): Promise<string>;
300
- getMessages(sessionId: string): Promise<any[]>;
301
- } | undefined);
302
- /**
303
- * Create a new workflow from definition
304
- */
305
- createWorkflow(definition: WorkflowDefinition, options?: CreateOptions): Promise<Workflow>;
306
- /**
307
- * Get workflow by id or name
308
- */
309
- getWorkflow(idOrName: string): Workflow | null;
310
- /**
311
- * Get workflow by id
312
- */
313
- getWorkflowById(id: string): Workflow | null;
314
- /**
315
- * Get workflow by name
316
- */
317
- getWorkflowByName(name: string): Workflow | null;
318
- /**
319
- * List workflows with optional filters
320
- */
321
- listWorkflows(options?: ListOptions): Workflow[];
322
- /**
323
- * Update an existing workflow
324
- */
325
- updateWorkflow(idOrName: string, updates: WorkflowUpdates, options?: {
326
- tags?: string[];
327
- }): Promise<Workflow>;
328
- /**
329
- * Delete a workflow by name or id
330
- */
331
- deleteWorkflow(idOrName: string): Promise<boolean>;
332
- /**
333
- * Run a workflow by definition or name
334
- *
335
- * This creates a Session that represents the workflow run.
336
- * The Session ID is used as the run identifier for pause/resume.
337
- */
338
- runWorkflow(idOrNameOrDefinition: string | WorkflowDefinition, input?: Record<string, any>, options?: RunOptions): Promise<RunResult>;
339
- /**
340
- * Run workflow by name (convenience method)
341
- */
342
- runWorkflowByName(name: string, input?: Record<string, any>, options?: RunOptions): Promise<RunResult>;
343
- /**
344
- * Stop a running workflow session
345
- */
346
- stopRun(sessionId: string, reason?: string): Promise<void>;
347
- /**
348
- * Get workflow session by ID
349
- */
350
- getSession(sessionId: string): Promise<SessionInfo | null>;
351
- /**
352
- * List workflow sessions
353
- */
354
- listSessions(options?: {
355
- limit?: number;
356
- offset?: number;
357
- }): Promise<SessionInfo[]>;
358
- /**
359
- * Get messages from a workflow session
360
- */
361
- getSessionMessages(sessionId: string): Promise<any[]>;
362
- }
363
- /**
364
- * Input schema for run-workflow tool
365
- */
366
- declare const RunWorkflowInputSchema: unknown;
367
- type RunWorkflowInput = z7.infer<typeof RunWorkflowInputSchema>;
368
- /**
369
- * Run Workflow Tool interface for type-safe access
370
- */
371
- interface RunWorkflowToolInterface {
372
- name: "run-workflow";
373
- description: string;
374
- inputSchema: typeof RunWorkflowInputSchema;
375
- }
376
- /**
377
- * Create a run-workflow tool with the given WorkflowService
378
- *
379
- * @param workflowService - The WorkflowService instance for executing workflows
380
- * @returns A Tool instance for running workflows
381
- */
382
- declare function createRunWorkflowTool(workflowService: WorkflowService): Tool;
383
- /**
384
- * Initialize the run-workflow tool with a WorkflowService
385
- *
386
- * @param workflowService - The WorkflowService instance
387
- */
388
- declare function initRunWorkflowTool(workflowService: WorkflowService): void;
389
- /**
390
- * Get the run-workflow tool instance
391
- *
392
- * @throws Error if the tool has not been initialized
393
- */
394
- declare function getRunWorkflowTool(): Tool;
395
- /**
396
- * Reset the run-workflow tool (for testing)
397
- */
398
- declare function resetRunWorkflowTool(): void;
399
- type RunWorkflowTool = ReturnType<typeof createRunWorkflowTool>;
400
- import { z as z8 } from "zod";
401
- /**
402
- * AskUserTool input schema
403
- */
404
- declare const AskUserInputSchema: unknown;
405
- type AskUserInput = z8.infer<typeof AskUserInputSchema>;
406
- /**
407
- * AskUserTool
408
- *
409
- * A special tool that can be called by Agent to request user input.
410
- * Calling this tool will throw AskUserError, which the Executor will
411
- * catch and convert to a workflow pause event.
412
- */
413
- type AskUserTool = ToolInfo<typeof AskUserInputSchema>;
414
- declare const askUserTool: AskUserTool;
415
- declare const askUserToolInstance: unknown;
416
- export { resetRunWorkflowTool, initRunWorkflowTool, getRunWorkflowTool, createRunWorkflowTool, askUserToolInstance, askUserTool, RunWorkflowToolInterface, RunWorkflowTool, RunWorkflowInputSchema, RunWorkflowInput, AskUserTool, AskUserInputSchema, AskUserInput };