@ai-setting/roy-agent-core 1.4.12 → 1.4.14

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 (127) hide show
  1. package/dist/packages/core/src/config/index.js +32 -0
  2. package/dist/packages/core/src/env/agent/index.js +24 -0
  3. package/dist/packages/core/src/env/commands/index.js +14 -0
  4. package/dist/packages/core/src/env/debug/formatters/index.js +11 -0
  5. package/dist/packages/core/src/env/debug/index.js +26 -0
  6. package/dist/packages/core/src/env/hook/index.js +29 -0
  7. package/dist/packages/core/src/env/index.js +81 -0
  8. package/dist/packages/core/src/env/llm/index.js +40 -0
  9. package/dist/packages/core/src/env/log-trace/index.js +83 -0
  10. package/dist/packages/core/src/env/mcp/index.js +39 -0
  11. package/dist/packages/core/src/env/mcp/tool/index.js +14 -0
  12. package/dist/packages/core/src/env/memory/built-in/index.js +11 -0
  13. package/dist/packages/core/src/env/memory/index.js +56 -0
  14. package/dist/packages/core/src/env/memory/plugin/index.js +36 -0
  15. package/dist/packages/core/src/env/prompt/index.js +20 -0
  16. package/dist/packages/core/src/env/session/index.js +25 -0
  17. package/dist/packages/core/src/env/session/storage/index.js +18 -0
  18. package/dist/packages/core/src/env/skill/index.js +34 -0
  19. package/dist/packages/core/src/env/skill/tool/index.js +9 -0
  20. package/dist/packages/core/src/env/task/delegate/index.js +18 -0
  21. package/dist/packages/core/src/env/task/hooks/index.js +7 -0
  22. package/dist/packages/core/src/env/task/index.js +30 -0
  23. package/dist/packages/core/src/env/task/plugins/index.js +23 -0
  24. package/dist/packages/core/src/env/task/storage/index.js +14 -0
  25. package/dist/packages/core/src/env/task/tools/index.js +17 -0
  26. package/dist/packages/core/src/env/task/tools/operation/index.js +15 -0
  27. package/dist/packages/core/src/env/tool/built-in/index.js +25 -0
  28. package/dist/packages/core/src/env/tool/index.js +39 -0
  29. package/dist/packages/core/src/env/workflow/decorators/index.js +27 -0
  30. package/dist/packages/core/src/env/workflow/engine/index.js +28 -0
  31. package/dist/packages/core/src/env/workflow/index.js +132 -0
  32. package/dist/packages/core/src/env/workflow/nodes/index.js +19 -0
  33. package/dist/packages/core/src/env/workflow/service/index.js +13 -0
  34. package/dist/packages/core/src/env/workflow/storage/index.js +27 -0
  35. package/dist/packages/core/src/env/workflow/tools/index.js +159 -0
  36. package/dist/packages/core/src/env/workflow/types/index.js +94 -0
  37. package/dist/packages/core/src/env/workflow/utils/index.js +637 -0
  38. package/dist/packages/core/src/index.js +398 -0
  39. package/dist/shared/@ai-setting/roy-agent-core-04fm8177.js +393 -0
  40. package/dist/shared/@ai-setting/roy-agent-core-04qgbjbe.js +172 -0
  41. package/dist/shared/@ai-setting/roy-agent-core-084qqd7t.js +11 -0
  42. package/dist/shared/@ai-setting/roy-agent-core-0gekht4e.js +1130 -0
  43. package/dist/shared/@ai-setting/roy-agent-core-0hdry23r.js +419 -0
  44. package/dist/shared/@ai-setting/roy-agent-core-0sgn3de4.js +102 -0
  45. package/dist/{env/task/tools/index.js → shared/@ai-setting/roy-agent-core-12x57kf1.js} +1 -59
  46. package/dist/shared/@ai-setting/roy-agent-core-1f3xrrm6.js +393 -0
  47. package/dist/shared/@ai-setting/roy-agent-core-1k28kg7h.js +368 -0
  48. package/dist/shared/@ai-setting/roy-agent-core-1z1zv5g8.js +258 -0
  49. package/dist/shared/@ai-setting/roy-agent-core-2hqxnaf3.js +851 -0
  50. package/dist/shared/@ai-setting/roy-agent-core-3dfq8awb.js +587 -0
  51. package/dist/shared/@ai-setting/roy-agent-core-3takar0s.js +93 -0
  52. package/dist/shared/@ai-setting/roy-agent-core-3tnb2005.js +117 -0
  53. package/dist/shared/@ai-setting/roy-agent-core-4vmcvkav.js +14 -0
  54. package/dist/shared/@ai-setting/roy-agent-core-4ws8atva.js +107 -0
  55. package/dist/{env/workflow/nodes/index.js → shared/@ai-setting/roy-agent-core-5fbp24se.js} +8 -55
  56. package/dist/shared/@ai-setting/roy-agent-core-5my94ywp.js +66 -0
  57. package/dist/shared/@ai-setting/roy-agent-core-6j0zcmwk.js +2146 -0
  58. package/dist/shared/@ai-setting/roy-agent-core-6w4pmxc7.js +266 -0
  59. package/dist/shared/@ai-setting/roy-agent-core-7vrk3add.js +10 -0
  60. package/dist/shared/@ai-setting/roy-agent-core-8dvbn7tw.js +64 -0
  61. package/dist/{env/memory/built-in/index.js → shared/@ai-setting/roy-agent-core-8mbmrwzs.js} +22 -76
  62. package/dist/shared/@ai-setting/roy-agent-core-8wzz66qe.js +620 -0
  63. package/dist/shared/@ai-setting/roy-agent-core-9ykq91jc.js +762 -0
  64. package/dist/shared/@ai-setting/roy-agent-core-dde19zke.js +1305 -0
  65. package/dist/shared/@ai-setting/roy-agent-core-f7g67gce.js +913 -0
  66. package/dist/{env/workflow/types/index.js → shared/@ai-setting/roy-agent-core-fq5mtxsy.js} +16 -154
  67. package/dist/{env/task/hooks/index.js → shared/@ai-setting/roy-agent-core-fs0mn2jk.js} +3 -18
  68. package/dist/{config/index.js → shared/@ai-setting/roy-agent-core-fvd9g6k8.js} +140 -605
  69. package/dist/shared/@ai-setting/roy-agent-core-gv1hrn3x.js +378 -0
  70. package/dist/{env/task/tools/operation/index.js → shared/@ai-setting/roy-agent-core-gy0wp5h7.js} +1 -58
  71. package/dist/shared/@ai-setting/roy-agent-core-hyza1gm7.js +15 -0
  72. package/dist/shared/@ai-setting/roy-agent-core-j8zx62zr.js +154 -0
  73. package/dist/shared/@ai-setting/roy-agent-core-jb2exr0d.js +442 -0
  74. package/dist/shared/@ai-setting/roy-agent-core-jv3b7v9w.js +57 -0
  75. package/dist/shared/@ai-setting/roy-agent-core-k1rxf9ya.js +513 -0
  76. package/dist/shared/@ai-setting/roy-agent-core-kydc9nwb.js +60 -0
  77. package/dist/shared/@ai-setting/roy-agent-core-m2x48hw6.js +97 -0
  78. package/dist/shared/@ai-setting/roy-agent-core-m6y668cc.js +377 -0
  79. package/dist/shared/@ai-setting/roy-agent-core-nczzf0ms.js +15 -0
  80. package/dist/shared/@ai-setting/roy-agent-core-nfj6knp5.js +36 -0
  81. package/dist/shared/@ai-setting/roy-agent-core-ntrp979d.js +204 -0
  82. package/dist/shared/@ai-setting/roy-agent-core-pd7g8z5v.js +1387 -0
  83. package/dist/shared/@ai-setting/roy-agent-core-pzk1syce.js +14 -0
  84. package/dist/shared/@ai-setting/roy-agent-core-q50tg9m2.js +862 -0
  85. package/dist/shared/@ai-setting/roy-agent-core-qg9tcaph.js +11 -0
  86. package/dist/shared/@ai-setting/roy-agent-core-qhyerewk.js +20 -0
  87. package/dist/shared/@ai-setting/roy-agent-core-qxybm159.js +82 -0
  88. package/dist/shared/@ai-setting/roy-agent-core-rh9dpkpw.js +549 -0
  89. package/dist/shared/@ai-setting/roy-agent-core-rr9p1g43.js +205 -0
  90. package/dist/{env/workflow/decorators/index.js → shared/@ai-setting/roy-agent-core-sbzvpfn7.js} +8 -173
  91. package/dist/shared/@ai-setting/roy-agent-core-t22nqt4d.js +788 -0
  92. package/dist/shared/@ai-setting/roy-agent-core-tkr5ynkh.js +200 -0
  93. package/dist/shared/@ai-setting/roy-agent-core-v4aabsf0.js +303 -0
  94. package/dist/{env/hook/index.js → shared/@ai-setting/roy-agent-core-w75rafhy.js} +3 -74
  95. package/dist/{env/debug/formatters/index.js → shared/@ai-setting/roy-agent-core-w76hqkmg.js} +11 -66
  96. package/dist/shared/@ai-setting/roy-agent-core-yfbgwes2.js +408 -0
  97. package/dist/shared/@ai-setting/roy-agent-core-yn761yve.js +299 -0
  98. package/dist/shared/@ai-setting/roy-agent-core-yrzmn4m1.js +492 -0
  99. package/dist/{env/workflow/service/index.js → shared/@ai-setting/roy-agent-core-yt8wdh2w.js} +1 -57
  100. package/package.json +3 -2
  101. package/dist/env/agent/index.js +0 -3035
  102. package/dist/env/commands/index.js +0 -1685
  103. package/dist/env/debug/index.js +0 -2300
  104. package/dist/env/index.js +0 -12591
  105. package/dist/env/llm/index.js +0 -2736
  106. package/dist/env/log-trace/index.js +0 -1779
  107. package/dist/env/mcp/index.js +0 -2173
  108. package/dist/env/mcp/tool/index.js +0 -1149
  109. package/dist/env/memory/index.js +0 -2171
  110. package/dist/env/memory/plugin/index.js +0 -1263
  111. package/dist/env/prompt/index.js +0 -2107
  112. package/dist/env/session/index.js +0 -3594
  113. package/dist/env/session/storage/index.js +0 -2049
  114. package/dist/env/skill/index.js +0 -1635
  115. package/dist/env/skill/tool/index.js +0 -114
  116. package/dist/env/task/delegate/index.js +0 -1844
  117. package/dist/env/task/index.js +0 -3578
  118. package/dist/env/task/plugins/index.js +0 -1626
  119. package/dist/env/task/storage/index.js +0 -1464
  120. package/dist/env/tool/built-in/index.js +0 -1151
  121. package/dist/env/tool/index.js +0 -2284
  122. package/dist/env/workflow/engine/index.js +0 -4391
  123. package/dist/env/workflow/index.js +0 -6214
  124. package/dist/env/workflow/storage/index.js +0 -1236
  125. package/dist/env/workflow/tools/index.js +0 -1081
  126. package/dist/env/workflow/utils/index.js +0 -1631
  127. package/dist/index.js +0 -22778
@@ -0,0 +1,205 @@
1
+ import {
2
+ AskUserError,
3
+ init_workflow_hil
4
+ } from "./roy-agent-core-8dvbn7tw.js";
5
+ import {
6
+ __esm
7
+ } from "./roy-agent-core-fs0mn2jk.js";
8
+
9
+ // packages/core/src/env/workflow/nodes/agent-component-adapter.ts
10
+ class AgentComponentAdapter {
11
+ agentComponent;
12
+ options;
13
+ _sessionComponent;
14
+ agentSessionPrefix = "agent";
15
+ _currentAgentSessionId;
16
+ pendingSessions = new Map;
17
+ runSessionToAgentSessions = new Map;
18
+ constructor(agentComponent, options = {}, _sessionComponent) {
19
+ this.agentComponent = agentComponent;
20
+ this.options = options;
21
+ this._sessionComponent = _sessionComponent;
22
+ }
23
+ setSessionComponent(sessionComponent) {
24
+ this._sessionComponent = sessionComponent;
25
+ }
26
+ getCurrentAgentSessionId() {
27
+ return this._currentAgentSessionId;
28
+ }
29
+ registerAgent(name, config) {
30
+ this.agentComponent.registerAgent(name, {
31
+ type: config.type || "general",
32
+ model: config.model,
33
+ systemPrompt: config.systemPrompt,
34
+ maxIterations: config.maxIterations,
35
+ allowedTools: config.allowedTools,
36
+ deniedTools: config.deniedTools,
37
+ timeout: config.timeout,
38
+ maxErrorRetries: config.maxErrorRetries
39
+ });
40
+ if (config.sessionIdPrefix) {
41
+ this.agentSessionPrefixes.set(name, config.sessionIdPrefix);
42
+ }
43
+ }
44
+ async run(config, resumeOptions) {
45
+ const startTime = Date.now();
46
+ const nodeId = config.nodeId || "unknown";
47
+ const runId = config.runId || "unknown";
48
+ const workflowSessionId = config.workflowSessionId;
49
+ const existingAgentSessionId = config.agentSessionId;
50
+ const resumeAgentSessionId = resumeOptions?.agentSessionId;
51
+ const isResume = !!resumeOptions?.userResponse || !!existingAgentSessionId || !!resumeAgentSessionId;
52
+ let agentSessionId;
53
+ if (isResume && (this._currentAgentSessionId || existingAgentSessionId || resumeAgentSessionId)) {
54
+ agentSessionId = resumeAgentSessionId || existingAgentSessionId || this._currentAgentSessionId;
55
+ if (resumeOptions?.userResponse && this._sessionComponent && agentSessionId) {
56
+ try {
57
+ await this._sessionComponent.addMessage(agentSessionId, {
58
+ role: "user",
59
+ content: resumeOptions.userResponse,
60
+ metadata: {
61
+ type: "user_intent",
62
+ intent: "workflow.resume",
63
+ workflowNodeId: nodeId
64
+ }
65
+ });
66
+ } catch (error) {
67
+ console.warn(`Failed to add user response to agent session ${agentSessionId}:`, error);
68
+ }
69
+ }
70
+ } else {
71
+ if (this._sessionComponent) {
72
+ agentSessionId = `${this.agentSessionPrefix}_${runId}_${nodeId}_${Date.now()}`;
73
+ try {
74
+ await this._sessionComponent.create({
75
+ title: `Agent Session: ${config.type} (${agentSessionId})`,
76
+ metadata: {
77
+ type: "agent",
78
+ workflowRunId: runId,
79
+ workflowNodeId: nodeId
80
+ }
81
+ });
82
+ this._currentAgentSessionId = agentSessionId;
83
+ if (workflowSessionId) {
84
+ const mapping = this.runSessionToAgentSessions.get(workflowSessionId) || [];
85
+ mapping.push(agentSessionId);
86
+ this.runSessionToAgentSessions.set(workflowSessionId, mapping);
87
+ }
88
+ this.pendingSessions.set(agentSessionId, {
89
+ agentSessionId,
90
+ nodeId,
91
+ runId,
92
+ createdAt: Date.now()
93
+ });
94
+ } catch (error) {
95
+ console.warn(`Failed to create agent session ${agentSessionId}:`, error);
96
+ }
97
+ }
98
+ }
99
+ try {
100
+ const context = {};
101
+ if (config.options?.timeout) {
102
+ context.abort = new AbortController;
103
+ }
104
+ if (agentSessionId) {
105
+ context.sessionId = agentSessionId;
106
+ }
107
+ if (config.options?.allowedTools) {
108
+ context.allowedTools = config.options.allowedTools;
109
+ }
110
+ if (config.options?.deniedTools) {
111
+ context.deniedTools = config.options.deniedTools;
112
+ }
113
+ if (config.workflowHistory) {
114
+ context.workflowHistory = config.workflowHistory;
115
+ }
116
+ const result = await this.agentComponent.run(config.type || "general", config.prompt, context);
117
+ if (result.error?.startsWith("__ASK_USER_ERROR__:")) {
118
+ const jsonStr = result.error.substring("__ASK_USER_ERROR__:".length);
119
+ const errorInfo = JSON.parse(jsonStr);
120
+ throw new AskUserError(runId, errorInfo.sessionId, errorInfo.nodeId, errorInfo.nodeType || "agent", errorInfo.query);
121
+ }
122
+ const duration = Date.now() - startTime;
123
+ if (agentSessionId) {
124
+ this.pendingSessions.delete(agentSessionId);
125
+ }
126
+ const messages = result._messages || [];
127
+ return {
128
+ output: result.finalText || result.output,
129
+ metadata: {
130
+ duration,
131
+ iterations: result.iterations,
132
+ toolCalls: result.toolCalls?.length,
133
+ agentSessionId
134
+ },
135
+ messages
136
+ };
137
+ } catch (error) {
138
+ const isAskUserError = error instanceof Error && error.name === "AskUserError";
139
+ if (isAskUserError) {
140
+ throw error;
141
+ }
142
+ const duration = Date.now() - startTime;
143
+ const errorMessage = error instanceof Error ? error.message : String(error);
144
+ if (agentSessionId) {
145
+ this.pendingSessions.delete(agentSessionId);
146
+ }
147
+ return {
148
+ output: undefined,
149
+ metadata: {
150
+ duration,
151
+ error: errorMessage,
152
+ agentSessionId
153
+ }
154
+ };
155
+ } finally {
156
+ if (!isResume) {
157
+ this._currentAgentSessionId = undefined;
158
+ }
159
+ }
160
+ }
161
+ async resumeAgent(agentSessionId, userResponse, config) {
162
+ if (this._sessionComponent) {
163
+ try {
164
+ await this._sessionComponent.addMessage(agentSessionId, {
165
+ role: "user",
166
+ content: userResponse,
167
+ metadata: {
168
+ type: "user_intent",
169
+ intent: "workflow.resume"
170
+ }
171
+ });
172
+ this.pendingSessions.delete(agentSessionId);
173
+ this._currentAgentSessionId = agentSessionId;
174
+ } catch (error) {
175
+ console.warn(`Failed to add user response to agent session ${agentSessionId}:`, error);
176
+ }
177
+ }
178
+ config.agentSessionId = agentSessionId;
179
+ return this.run(config, { userResponse });
180
+ }
181
+ getPendingSession(agentSessionId) {
182
+ return this.pendingSessions.get(agentSessionId);
183
+ }
184
+ getPendingSessionsForRun(runId) {
185
+ return Array.from(this.pendingSessions.values()).filter((session) => session.runId === runId);
186
+ }
187
+ getAgentSessionsForWorkflowSession(workflowSessionId) {
188
+ return this.runSessionToAgentSessions.get(workflowSessionId) || [];
189
+ }
190
+ hasAgent(name) {
191
+ return this.agentComponent.getAgent(name) !== undefined;
192
+ }
193
+ listAgents() {
194
+ return this.agentComponent.listAgents().map((a) => a.name);
195
+ }
196
+ getAgentComponent() {
197
+ return this.agentComponent;
198
+ }
199
+ agentSessionPrefixes = new Map;
200
+ }
201
+ var init_agent_component_adapter = __esm(() => {
202
+ init_workflow_hil();
203
+ });
204
+
205
+ export { AgentComponentAdapter, init_agent_component_adapter };
@@ -1,164 +1,6 @@
1
- // @bun
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- function __accessProp(key) {
7
- return this[key];
8
- }
9
- var __toCommonJS = (from) => {
10
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
11
- if (entry)
12
- return entry;
13
- entry = __defProp({}, "__esModule", { value: true });
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (var key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(entry, key))
17
- __defProp(entry, key, {
18
- get: __accessProp.bind(from, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- __moduleCache.set(from, entry);
23
- return entry;
24
- };
25
- var __moduleCache;
26
- var __returnValue = (v) => v;
27
- function __exportSetter(name, newValue) {
28
- this[name] = __returnValue.bind(null, newValue);
29
- }
30
- var __export = (target, all) => {
31
- for (var name in all)
32
- __defProp(target, name, {
33
- get: all[name],
34
- enumerable: true,
35
- configurable: true,
36
- set: __exportSetter.bind(all, name)
37
- });
38
- };
39
- var __legacyDecorateClassTS = function(decorators, target, key, desc) {
40
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
41
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
42
- r = Reflect.decorate(decorators, target, key, desc);
43
- else
44
- for (var i = decorators.length - 1;i >= 0; i--)
45
- if (d = decorators[i])
46
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
47
- return c > 3 && r && Object.defineProperty(target, key, r), r;
48
- };
49
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
50
- var __require = import.meta.require;
51
-
52
- // packages/core/src/env/workflow/decorators/decorator-node.ts
53
- class DecoratorNode {
54
- type = "decorator";
55
- id;
56
- methodName;
57
- instance;
58
- dependsOn;
59
- timeout;
60
- retryConfig;
61
- constructor(definition) {
62
- const config = definition.config;
63
- this.id = definition.id;
64
- this.methodName = config._methodName;
65
- this.instance = config._instance;
66
- this.dependsOn = definition.depends_on || [];
67
- this.timeout = definition.timeout;
68
- this.retryConfig = definition.retry;
69
- }
70
- async execute(context) {
71
- const startTime = Date.now();
72
- const method = this.instance[this.methodName];
73
- if (typeof method !== "function") {
74
- return {
75
- success: false,
76
- error: `Method '${this.methodName}' is not a function`,
77
- duration: Date.now() - startTime
78
- };
79
- }
80
- const input = this.prepareInput(context);
81
- const result = await this.executeWithRetry(input, context.abort);
82
- return {
83
- success: !result.error,
84
- output: result.output,
85
- error: result.error,
86
- duration: Date.now() - startTime,
87
- metadata: {
88
- methodName: this.methodName
89
- }
90
- };
91
- }
92
- prepareInput(context) {
93
- const nodeOutputs = context.nodeOutputs;
94
- if (this.dependsOn.length === 0) {
95
- return context.input || {};
96
- }
97
- const input = {};
98
- for (const depId of this.dependsOn) {
99
- const depOutput = nodeOutputs instanceof Map ? nodeOutputs.get(depId) : nodeOutputs?.[depId];
100
- if (depOutput && typeof depOutput === "object") {
101
- if ("output" in depOutput) {
102
- input[depId] = depOutput.output;
103
- } else {
104
- input[depId] = depOutput;
105
- }
106
- }
107
- }
108
- return input;
109
- }
110
- async executeWithRetry(input, abort) {
111
- const maxAttempts = this.retryConfig?.max_attempts ?? 1;
112
- const backoff = this.retryConfig?.backoff ?? "exponential";
113
- const initialDelay = this.retryConfig?.initial_delay ?? 1000;
114
- let lastError;
115
- for (let attempt = 1;attempt <= maxAttempts; attempt++) {
116
- if (abort?.aborted) {
117
- return { error: "Execution aborted" };
118
- }
119
- try {
120
- const output = await this.executeWithTimeout(input, abort);
121
- return { output };
122
- } catch (error) {
123
- lastError = error instanceof Error ? error : new Error(String(error));
124
- if (attempt < maxAttempts) {
125
- const delay = this.calculateBackoff(backoff, initialDelay, attempt - 1);
126
- await this.sleep(delay, abort);
127
- }
128
- }
129
- }
130
- return { error: lastError?.message || "Unknown error" };
131
- }
132
- async executeWithTimeout(input, abort) {
133
- if (!this.timeout) {
134
- return this.instance[this.methodName](input);
135
- }
136
- const timeoutPromise = new Promise((_, reject) => {
137
- setTimeout(() => {
138
- reject(new Error(`Execution timeout after ${this.timeout}ms`));
139
- }, this.timeout);
140
- });
141
- return Promise.race([
142
- this.instance[this.methodName](input),
143
- timeoutPromise
144
- ]);
145
- }
146
- calculateBackoff(backoff, initialDelay, attempt) {
147
- if (backoff === "exponential") {
148
- return initialDelay * Math.pow(2, attempt);
149
- }
150
- return initialDelay;
151
- }
152
- sleep(ms, abort) {
153
- return new Promise((resolve) => {
154
- const timeout = setTimeout(resolve, ms);
155
- abort?.addEventListener("abort", () => {
156
- clearTimeout(timeout);
157
- resolve();
158
- });
159
- });
160
- }
161
- }
1
+ import {
2
+ init_decorator_node
3
+ } from "./roy-agent-core-3tnb2005.js";
162
4
 
163
5
  // packages/core/src/env/workflow/decorators/workflow.ts
164
6
  import"reflect-metadata";
@@ -249,6 +91,10 @@ function WorkflowEdges(edges) {
249
91
  function getEdgeMetadatas(target) {
250
92
  return Reflect.getMetadata(EDGE_METADATA_KEY, target) || [];
251
93
  }
94
+
95
+ // packages/core/src/env/workflow/decorators/index.ts
96
+ init_decorator_node();
97
+
252
98
  // packages/core/src/env/workflow/extractor/workflow-converter.ts
253
99
  import"reflect-metadata";
254
100
  class WorkflowConverter {
@@ -435,15 +281,4 @@ function createWorkflowFromClass(targetClass, options) {
435
281
  const instance = options?.instance ?? new targetClass(...options?.constructorArgs ?? []);
436
282
  return WorkflowConverter.fromClass(targetClass, instance);
437
283
  }
438
- export {
439
- getWorkflowMetadata,
440
- getNodeMetadatas,
441
- getEdgeMetadatas,
442
- createWorkflowFromClass,
443
- WorkflowEdges,
444
- WorkflowConverter,
445
- Workflow,
446
- NodeAs,
447
- Edge,
448
- DecoratorNode
449
- };
284
+ export { Workflow, getWorkflowMetadata, NodeAs, getNodeMetadatas, Edge, WorkflowEdges, getEdgeMetadatas, WorkflowConverter, createWorkflowFromClass };