@ai-setting/roy-agent-core 1.5.42 → 1.5.44

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 (31) hide show
  1. package/dist/env/agent/index.js +2 -2
  2. package/dist/env/index.js +11 -10
  3. package/dist/env/task/delegate/index.js +3 -2
  4. package/dist/env/task/index.js +3 -3
  5. package/dist/env/tool/built-in/index.js +1 -1
  6. package/dist/env/tool/index.js +2 -2
  7. package/dist/env/workflow/decorators/index.js +1 -1
  8. package/dist/env/workflow/engine/index.js +4 -3
  9. package/dist/env/workflow/index.js +34 -19
  10. package/dist/env/workflow/nodes/index.js +5 -1
  11. package/dist/env/workflow/types/index.js +16 -2
  12. package/dist/env/workflow/utils/index.js +15 -196
  13. package/dist/index.js +13 -12
  14. package/dist/shared/@ai-setting/{roy-agent-core-9q6sa7m3.js → roy-agent-core-1zq3p19q.js} +1 -1
  15. package/dist/shared/@ai-setting/{roy-agent-core-ffb9fq4v.js → roy-agent-core-23gw9c4s.js} +2 -2
  16. package/dist/shared/@ai-setting/{roy-agent-core-bmr6bdfb.js → roy-agent-core-2ms7296b.js} +4 -4
  17. package/dist/shared/@ai-setting/{roy-agent-core-2jnzv9at.js → roy-agent-core-38dkek2y.js} +319 -189
  18. package/dist/shared/@ai-setting/roy-agent-core-6vxg2gmr.js +321 -0
  19. package/dist/shared/@ai-setting/{roy-agent-core-0rtxwr28.js → roy-agent-core-9bmtxmp6.js} +77 -120
  20. package/dist/shared/@ai-setting/{roy-agent-core-xz22rmak.js → roy-agent-core-9p43ap7h.js} +21 -7
  21. package/dist/shared/@ai-setting/{roy-agent-core-7t05apnp.js → roy-agent-core-fg3j215p.js} +26 -0
  22. package/dist/shared/@ai-setting/{roy-agent-core-7fgf85wc.js → roy-agent-core-h0x19xgn.js} +6 -7
  23. package/dist/shared/@ai-setting/roy-agent-core-qnrf2aw6.js +441 -0
  24. package/dist/shared/@ai-setting/{roy-agent-core-ek6gk3wk.js → roy-agent-core-r6rwsr54.js} +42 -3
  25. package/dist/shared/@ai-setting/roy-agent-core-v002ynpa.js +435 -0
  26. package/dist/shared/@ai-setting/{roy-agent-core-rsybkb38.js → roy-agent-core-ysvh8er9.js} +36 -39
  27. package/dist/shared/@ai-setting/{roy-agent-core-9yxb3ty9.js → roy-agent-core-z5sxe4p7.js} +5 -1
  28. package/package.json +1 -1
  29. package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
  30. package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
  31. /package/dist/shared/@ai-setting/{roy-agent-core-e130w7mv.js → roy-agent-core-ryw3ckfy.js} +0 -0
@@ -1,350 +0,0 @@
1
- import {
2
- AskUserError,
3
- init_workflow_hil
4
- } from "./roy-agent-core-e25xkv53.js";
5
- import {
6
- __esm,
7
- __require
8
- } from "./roy-agent-core-fs0mn2jk.js";
9
-
10
- // src/env/workflow/types/workflow.ts
11
- import { z } from "zod";
12
- async function getYamlParser() {
13
- if (!yamlParser) {
14
- yamlParser = await import("yaml");
15
- }
16
- return yamlParser;
17
- }
18
- async function parseWorkflowFile(content, filename) {
19
- const isYaml = filename.endsWith(".yaml") || filename.endsWith(".yml");
20
- const isJson = filename.endsWith(".json");
21
- let definition;
22
- if (isYaml) {
23
- const yaml = await getYamlParser();
24
- definition = WorkflowDefinitionSchema.parse(yaml.parse(content));
25
- } else if (isJson) {
26
- definition = WorkflowDefinitionSchema.parse(JSON.parse(content));
27
- } else {
28
- try {
29
- definition = WorkflowDefinitionSchema.parse(JSON.parse(content));
30
- } catch {
31
- const yaml = await getYamlParser();
32
- definition = WorkflowDefinitionSchema.parse(yaml.parse(content));
33
- }
34
- }
35
- return {
36
- format: isYaml ? "yaml" : "json",
37
- definition
38
- };
39
- }
40
- function parseWorkflowFileSync(content, filename) {
41
- const isYaml = filename.endsWith(".yaml") || filename.endsWith(".yml");
42
- const isJson = filename.endsWith(".json");
43
- let definition;
44
- if (isJson) {
45
- definition = WorkflowDefinitionSchema.parse(JSON.parse(content));
46
- } else if (isYaml) {
47
- throw new Error("Synchronous YAML parsing not supported. Use parseWorkflowFile() instead.");
48
- } else {
49
- try {
50
- definition = WorkflowDefinitionSchema.parse(JSON.parse(content));
51
- } catch {
52
- throw new Error("Cannot auto-detect format. Please use .yaml, .yml, or .json extension.");
53
- }
54
- }
55
- return {
56
- format: isJson ? "json" : "yaml",
57
- definition
58
- };
59
- }
60
- var DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, yamlParser = null;
61
- var init_workflow = __esm(() => {
62
- DependsOnSchema = z.array(z.string());
63
- RetryConfigSchema = z.object({
64
- max_attempts: z.number().min(1).default(1),
65
- backoff: z.enum(["fixed", "exponential"]).default("exponential"),
66
- initial_delay: z.number().min(0).default(1000)
67
- });
68
- NodeDefinitionSchema = z.object({
69
- id: z.string().min(1, "Node ID is required"),
70
- type: z.string().min(1, "Node type is required"),
71
- name: z.string().optional(),
72
- config: z.record(z.string(), z.unknown()).optional().default({}),
73
- depends_on: z.array(z.string()).optional(),
74
- condition: z.string().optional(),
75
- retry: RetryConfigSchema.optional(),
76
- timeout: z.number().optional()
77
- });
78
- WorkflowConfigSchema = z.object({
79
- parallel_limit: z.number().nullable().optional(),
80
- timeout: z.number().nullable().optional(),
81
- retry: RetryConfigSchema.optional(),
82
- debug: z.boolean().optional()
83
- });
84
- OutputDefinitionSchema = z.object({
85
- name: z.string(),
86
- source: z.string(),
87
- path: z.string()
88
- });
89
- InputParameterSchema = z.object({
90
- type: z.enum(["string", "number", "boolean", "object", "array"]),
91
- description: z.string().optional(),
92
- default: z.unknown().optional(),
93
- required: z.boolean().default(false)
94
- });
95
- WorkflowInputsSchema = z.record(z.string(), InputParameterSchema);
96
- WorkflowMetadataSchema = z.object({
97
- author: z.string().optional(),
98
- taskId: z.number().optional(),
99
- tags: z.array(z.string()).optional().default([]),
100
- created_at: z.string().optional(),
101
- updated_at: z.string().optional()
102
- });
103
- WorkflowDefinitionSchema = z.object({
104
- name: z.string().min(1, "Workflow name is required"),
105
- version: z.string().default("1.0"),
106
- description: z.string().optional(),
107
- config: WorkflowConfigSchema.optional().default({}),
108
- nodes: z.array(NodeDefinitionSchema).min(1, "At least one node is required"),
109
- entry: z.union([z.string(), z.array(z.string())]).default("__default_entry__"),
110
- outputs: z.array(OutputDefinitionSchema).optional().default([]),
111
- inputs: WorkflowInputsSchema.optional().default({}),
112
- metadata: WorkflowMetadataSchema.optional().default({})
113
- });
114
- });
115
-
116
- // src/env/workflow/types/workflow-message.ts
117
- import { z as z2 } from "zod";
118
- var WorkflowMessageRoleSchema;
119
- var init_workflow_message = __esm(() => {
120
- init_workflow_hil();
121
- WorkflowMessageRoleSchema = z2.enum([
122
- "workflow.node.start",
123
- "workflow.node.interrupt",
124
- "workflow.node.end",
125
- "workflow.node.resume"
126
- ]);
127
- });
128
-
129
- // src/env/workflow/types/workflow-session.ts
130
- function isWorkflowSessionMetadata(metadata) {
131
- if (typeof metadata !== "object" || metadata === null || !("type" in metadata) || metadata.type !== "workflow") {
132
- return false;
133
- }
134
- const m = metadata;
135
- if (!m.workflowId || typeof m.workflowId !== "string") {
136
- return false;
137
- }
138
- if (!m.workflowName || typeof m.workflowName !== "string") {
139
- return false;
140
- }
141
- if (!m.status || typeof m.status !== "string") {
142
- return false;
143
- }
144
- const validStatuses = ["running", "paused", "completed", "failed", "stopped"];
145
- if (!validStatuses.includes(m.status)) {
146
- return false;
147
- }
148
- return true;
149
- }
150
- function getWorkflowSessionStatus(metadata) {
151
- return metadata.status || "running";
152
- }
153
- var init_workflow_session = () => {};
154
-
155
- // src/env/workflow/types/context.ts
156
- var init_context = () => {};
157
-
158
- // src/env/workflow/types/event.ts
159
- import { z as z3 } from "zod";
160
- function createWorkflowEvent(type, runId, data) {
161
- return {
162
- type,
163
- run_id: runId,
164
- timestamp: Date.now(),
165
- ...data
166
- };
167
- }
168
- var BaseEventSchema, WorkflowStartedEventSchema, WorkflowPausedEventSchema, WorkflowResumedEventSchema, WorkflowStoppedEventSchema, WorkflowCompletedEventSchema, WorkflowFailedEventSchema, WorkflowOutputEventSchema, NodeScheduledEventSchema, NodeStartedEventSchema, NodeProgressEventSchema, NodeCompletedEventSchema, NodeFailedEventSchema, NodeSkippedEventSchema, NodeDataEventSchema, NodeAddedEventSchema, NodeRemovedEventSchema, ControlPauseEventSchema, ControlResumeEventSchema, ControlStopEventSchema, NodeInterruptEventSchema, WorkflowAskUserEventSchema, WorkflowEventSchema;
169
- var init_event = __esm(() => {
170
- BaseEventSchema = z3.object({
171
- type: z3.string(),
172
- run_id: z3.string(),
173
- timestamp: z3.number()
174
- });
175
- WorkflowStartedEventSchema = BaseEventSchema.extend({
176
- type: z3.literal("workflow.started"),
177
- workflow_name: z3.string(),
178
- input: z3.record(z3.string(), z3.unknown()).optional()
179
- });
180
- WorkflowPausedEventSchema = BaseEventSchema.extend({
181
- type: z3.literal("workflow.paused")
182
- });
183
- WorkflowResumedEventSchema = BaseEventSchema.extend({
184
- type: z3.literal("workflow.resumed")
185
- });
186
- WorkflowStoppedEventSchema = BaseEventSchema.extend({
187
- type: z3.literal("workflow.stopped"),
188
- reason: z3.string()
189
- });
190
- WorkflowCompletedEventSchema = BaseEventSchema.extend({
191
- type: z3.literal("workflow.completed"),
192
- result: z3.record(z3.string(), z3.unknown()).optional(),
193
- duration_ms: z3.number()
194
- });
195
- WorkflowFailedEventSchema = BaseEventSchema.extend({
196
- type: z3.literal("workflow.failed"),
197
- error: z3.object({
198
- message: z3.string(),
199
- stack: z3.string().optional()
200
- }),
201
- failed_at: z3.string()
202
- });
203
- WorkflowOutputEventSchema = BaseEventSchema.extend({
204
- type: z3.literal("workflow.output"),
205
- output: z3.record(z3.string(), z3.unknown())
206
- });
207
- NodeScheduledEventSchema = BaseEventSchema.extend({
208
- type: z3.literal("node.scheduled"),
209
- node_id: z3.string()
210
- });
211
- NodeStartedEventSchema = BaseEventSchema.extend({
212
- type: z3.literal("node.started"),
213
- node_id: z3.string(),
214
- input: z3.any().optional(),
215
- agentSessionId: z3.string().optional(),
216
- userQuery: z3.string().optional(),
217
- userResponse: z3.string().optional()
218
- });
219
- NodeProgressEventSchema = BaseEventSchema.extend({
220
- type: z3.literal("node.progress"),
221
- node_id: z3.string(),
222
- progress: z3.number(),
223
- message: z3.string().optional()
224
- });
225
- NodeCompletedEventSchema = BaseEventSchema.extend({
226
- type: z3.literal("node.completed"),
227
- node_id: z3.string(),
228
- output: z3.any(),
229
- duration_ms: z3.number()
230
- });
231
- NodeFailedEventSchema = BaseEventSchema.extend({
232
- type: z3.literal("node.failed"),
233
- node_id: z3.string(),
234
- error: z3.object({
235
- message: z3.string(),
236
- stack: z3.string().optional()
237
- })
238
- });
239
- NodeSkippedEventSchema = BaseEventSchema.extend({
240
- type: z3.literal("node.skipped"),
241
- node_id: z3.string(),
242
- reason: z3.string()
243
- });
244
- NodeDataEventSchema = BaseEventSchema.extend({
245
- type: z3.literal("node.data"),
246
- from_node: z3.string(),
247
- to_node: z3.string(),
248
- data: z3.any()
249
- });
250
- NodeAddedEventSchema = BaseEventSchema.extend({
251
- type: z3.literal("node.added"),
252
- node_id: z3.string(),
253
- node: z3.any()
254
- });
255
- NodeRemovedEventSchema = BaseEventSchema.extend({
256
- type: z3.literal("node.removed"),
257
- node_id: z3.string()
258
- });
259
- ControlPauseEventSchema = BaseEventSchema.extend({
260
- type: z3.literal("control.pause")
261
- });
262
- ControlResumeEventSchema = BaseEventSchema.extend({
263
- type: z3.literal("control.resume")
264
- });
265
- ControlStopEventSchema = BaseEventSchema.extend({
266
- type: z3.literal("control.stop")
267
- });
268
- NodeInterruptEventSchema = BaseEventSchema.extend({
269
- type: z3.literal("node.interrupt"),
270
- node_id: z3.string(),
271
- node_type: z3.string(),
272
- query: z3.string()
273
- });
274
- WorkflowAskUserEventSchema = BaseEventSchema.extend({
275
- type: z3.literal("workflow.ask-user"),
276
- session_id: z3.string(),
277
- node_id: z3.string(),
278
- node_type: z3.string(),
279
- query: z3.string()
280
- });
281
- WorkflowEventSchema = z3.union([
282
- WorkflowStartedEventSchema,
283
- WorkflowPausedEventSchema,
284
- WorkflowResumedEventSchema,
285
- WorkflowStoppedEventSchema,
286
- WorkflowCompletedEventSchema,
287
- WorkflowFailedEventSchema,
288
- WorkflowOutputEventSchema,
289
- NodeScheduledEventSchema,
290
- NodeStartedEventSchema,
291
- NodeProgressEventSchema,
292
- NodeCompletedEventSchema,
293
- NodeFailedEventSchema,
294
- NodeSkippedEventSchema,
295
- NodeDataEventSchema,
296
- NodeAddedEventSchema,
297
- NodeRemovedEventSchema,
298
- ControlPauseEventSchema,
299
- ControlResumeEventSchema,
300
- ControlStopEventSchema,
301
- NodeInterruptEventSchema,
302
- WorkflowAskUserEventSchema
303
- ]);
304
- });
305
-
306
- // src/env/workflow/types/run.ts
307
- import { z as z4 } from "zod";
308
- function createNodeExecutionContext(params) {
309
- return {
310
- ...params,
311
- askUser: (query) => {
312
- throw new AskUserError(params.runId, params.sessionId, params.nodeId, "unknown", query);
313
- }
314
- };
315
- }
316
- var RunStatusSchema, NodeStatusSchema;
317
- var init_run = __esm(() => {
318
- init_workflow_message();
319
- RunStatusSchema = z4.enum([
320
- "idle",
321
- "running",
322
- "paused",
323
- "stopped",
324
- "completed",
325
- "failed"
326
- ]);
327
- NodeStatusSchema = z4.enum([
328
- "pending",
329
- "scheduled",
330
- "started",
331
- "running",
332
- "completed",
333
- "failed",
334
- "skipped"
335
- ]);
336
- });
337
-
338
- // src/env/workflow/types/index.ts
339
- var init_types = __esm(() => {
340
- init_run();
341
- init_workflow();
342
- init_workflow_message();
343
- init_workflow_session();
344
- init_context();
345
- init_workflow_hil();
346
- init_event();
347
- init_run();
348
- });
349
-
350
- export { 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, DependsOnSchema, RetryConfigSchema, NodeDefinitionSchema, WorkflowConfigSchema, OutputDefinitionSchema, InputParameterSchema, WorkflowInputsSchema, WorkflowMetadataSchema, WorkflowDefinitionSchema, parseWorkflowFile, parseWorkflowFileSync, WorkflowMessageRoleSchema, isWorkflowSessionMetadata, getWorkflowSessionStatus, RunStatusSchema, NodeStatusSchema, createNodeExecutionContext, init_types };