@ai-setting/roy-agent-core 1.4.13 → 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.
- package/dist/packages/core/src/config/index.js +32 -0
- package/dist/packages/core/src/env/agent/index.js +24 -0
- package/dist/packages/core/src/env/commands/index.js +14 -0
- package/dist/packages/core/src/env/debug/formatters/index.js +11 -0
- package/dist/packages/core/src/env/debug/index.js +26 -0
- package/dist/packages/core/src/env/hook/index.js +29 -0
- package/dist/packages/core/src/env/index.js +81 -0
- package/dist/packages/core/src/env/llm/index.js +40 -0
- package/dist/packages/core/src/env/log-trace/index.js +83 -0
- package/dist/packages/core/src/env/mcp/index.js +39 -0
- package/dist/packages/core/src/env/mcp/tool/index.js +14 -0
- package/dist/packages/core/src/env/memory/built-in/index.js +11 -0
- package/dist/packages/core/src/env/memory/index.js +56 -0
- package/dist/packages/core/src/env/memory/plugin/index.js +36 -0
- package/dist/packages/core/src/env/prompt/index.js +20 -0
- package/dist/packages/core/src/env/session/index.js +25 -0
- package/dist/packages/core/src/env/session/storage/index.js +18 -0
- package/dist/packages/core/src/env/skill/index.js +34 -0
- package/dist/packages/core/src/env/skill/tool/index.js +9 -0
- package/dist/packages/core/src/env/task/delegate/index.js +18 -0
- package/dist/packages/core/src/env/task/hooks/index.js +7 -0
- package/dist/packages/core/src/env/task/index.js +30 -0
- package/dist/packages/core/src/env/task/plugins/index.js +23 -0
- package/dist/packages/core/src/env/task/storage/index.js +14 -0
- package/dist/packages/core/src/env/task/tools/index.js +17 -0
- package/dist/packages/core/src/env/task/tools/operation/index.js +15 -0
- package/dist/{shared/chunk-1d4rwms4.js → packages/core/src/env/tool/built-in/index.js} +4 -4
- package/dist/packages/core/src/env/tool/index.js +39 -0
- package/dist/packages/core/src/env/workflow/decorators/index.js +27 -0
- package/dist/packages/core/src/env/workflow/engine/index.js +28 -0
- package/dist/packages/core/src/env/workflow/index.js +132 -0
- package/dist/packages/core/src/env/workflow/nodes/index.js +19 -0
- package/dist/packages/core/src/env/workflow/service/index.js +13 -0
- package/dist/packages/core/src/env/workflow/storage/index.js +27 -0
- package/dist/packages/core/src/env/workflow/tools/index.js +159 -0
- package/dist/packages/core/src/env/workflow/types/index.js +94 -0
- package/dist/packages/core/src/env/workflow/utils/index.js +637 -0
- package/dist/packages/core/src/index.js +398 -0
- package/dist/shared/@ai-setting/roy-agent-core-04fm8177.js +393 -0
- package/dist/shared/@ai-setting/roy-agent-core-04qgbjbe.js +172 -0
- package/dist/shared/@ai-setting/roy-agent-core-084qqd7t.js +11 -0
- package/dist/shared/@ai-setting/roy-agent-core-0gekht4e.js +1130 -0
- package/dist/shared/@ai-setting/roy-agent-core-0hdry23r.js +419 -0
- package/dist/shared/{chunk-ze20rksg.js → @ai-setting/roy-agent-core-0sgn3de4.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-12x57kf1.js +286 -0
- package/dist/shared/@ai-setting/roy-agent-core-1f3xrrm6.js +393 -0
- package/dist/shared/{chunk-q9j99fsm.js → @ai-setting/roy-agent-core-1k28kg7h.js} +6 -6
- package/dist/shared/{chunk-2b5kbhx3.js → @ai-setting/roy-agent-core-1z1zv5g8.js} +9 -117
- package/dist/shared/@ai-setting/roy-agent-core-2hqxnaf3.js +851 -0
- package/dist/shared/@ai-setting/roy-agent-core-3dfq8awb.js +587 -0
- package/dist/shared/@ai-setting/roy-agent-core-3takar0s.js +93 -0
- package/dist/shared/@ai-setting/roy-agent-core-3tnb2005.js +117 -0
- package/dist/shared/@ai-setting/roy-agent-core-4vmcvkav.js +14 -0
- package/dist/shared/{chunk-25x2pdtp.js → @ai-setting/roy-agent-core-4ws8atva.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-5fbp24se.js +603 -0
- package/dist/shared/@ai-setting/roy-agent-core-5my94ywp.js +66 -0
- package/dist/shared/{chunk-rncy3rtd.js → @ai-setting/roy-agent-core-6j0zcmwk.js} +128 -1122
- package/dist/shared/@ai-setting/roy-agent-core-6w4pmxc7.js +266 -0
- package/dist/shared/{chunk-yqmx37vm.js → @ai-setting/roy-agent-core-7vrk3add.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-8dvbn7tw.js +64 -0
- package/dist/shared/@ai-setting/roy-agent-core-8mbmrwzs.js +171 -0
- package/dist/shared/@ai-setting/roy-agent-core-8wzz66qe.js +620 -0
- package/dist/shared/@ai-setting/roy-agent-core-9ykq91jc.js +762 -0
- package/dist/shared/@ai-setting/roy-agent-core-dde19zke.js +1305 -0
- package/dist/shared/@ai-setting/roy-agent-core-f7g67gce.js +913 -0
- package/dist/shared/@ai-setting/roy-agent-core-fq5mtxsy.js +341 -0
- package/dist/shared/@ai-setting/roy-agent-core-fvd9g6k8.js +1205 -0
- package/dist/shared/@ai-setting/roy-agent-core-gv1hrn3x.js +378 -0
- package/dist/shared/@ai-setting/roy-agent-core-gy0wp5h7.js +213 -0
- package/dist/shared/{chunk-mf5xqbdh.js → @ai-setting/roy-agent-core-hyza1gm7.js} +3 -2
- package/dist/shared/{chunk-1qwabsm0.js → @ai-setting/roy-agent-core-j8zx62zr.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-jb2exr0d.js +442 -0
- package/dist/shared/@ai-setting/roy-agent-core-jv3b7v9w.js +57 -0
- package/dist/shared/@ai-setting/roy-agent-core-k1rxf9ya.js +513 -0
- package/dist/shared/@ai-setting/roy-agent-core-kydc9nwb.js +60 -0
- package/dist/shared/@ai-setting/roy-agent-core-m2x48hw6.js +97 -0
- package/dist/shared/@ai-setting/roy-agent-core-m6y668cc.js +377 -0
- package/dist/shared/{chunk-1aakcfp1.js → @ai-setting/roy-agent-core-nczzf0ms.js} +3 -3
- package/dist/shared/@ai-setting/roy-agent-core-nfj6knp5.js +36 -0
- package/dist/shared/@ai-setting/roy-agent-core-ntrp979d.js +204 -0
- package/dist/shared/@ai-setting/roy-agent-core-pd7g8z5v.js +1387 -0
- package/dist/shared/@ai-setting/roy-agent-core-pzk1syce.js +14 -0
- package/dist/shared/@ai-setting/roy-agent-core-q50tg9m2.js +862 -0
- package/dist/shared/{chunk-9qzt1v1p.js → @ai-setting/roy-agent-core-qg9tcaph.js} +3 -2
- package/dist/shared/{chunk-91bas8w5.js → @ai-setting/roy-agent-core-qhyerewk.js} +5 -5
- package/dist/shared/{chunk-1pf5mfgd.js → @ai-setting/roy-agent-core-qxybm159.js} +3 -3
- package/dist/shared/{chunk-g6j5n3gv.js → @ai-setting/roy-agent-core-rh9dpkpw.js} +10 -10
- package/dist/shared/{chunk-0q6s9wm6.js → @ai-setting/roy-agent-core-rr9p1g43.js} +7 -51
- package/dist/shared/@ai-setting/roy-agent-core-sbzvpfn7.js +284 -0
- package/dist/shared/@ai-setting/roy-agent-core-t22nqt4d.js +788 -0
- package/dist/shared/{chunk-t1rh6jtm.js → @ai-setting/roy-agent-core-tkr5ynkh.js} +8 -13
- package/dist/shared/@ai-setting/roy-agent-core-v4aabsf0.js +303 -0
- package/dist/shared/@ai-setting/roy-agent-core-w75rafhy.js +202 -0
- package/dist/shared/@ai-setting/roy-agent-core-w76hqkmg.js +584 -0
- package/dist/shared/@ai-setting/roy-agent-core-yfbgwes2.js +408 -0
- package/dist/shared/{chunk-a9qmy3sc.js → @ai-setting/roy-agent-core-yn761yve.js} +7 -4
- package/dist/shared/@ai-setting/roy-agent-core-yrzmn4m1.js +492 -0
- package/dist/shared/@ai-setting/roy-agent-core-yt8wdh2w.js +206 -0
- package/package.json +8 -7
- package/dist/index.d.ts +0 -7825
- package/dist/index.js +0 -16551
- package/dist/shared/chunk-hs7tbmje.js +0 -24
- /package/dist/shared/{chunk-wbkh7wat.js → @ai-setting/roy-agent-core-fs0mn2jk.js} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
4
|
+
|
|
5
|
+
// packages/core/src/env/workflow/decorators/decorator-node.ts
|
|
6
|
+
class DecoratorNode {
|
|
7
|
+
type = "decorator";
|
|
8
|
+
id;
|
|
9
|
+
methodName;
|
|
10
|
+
instance;
|
|
11
|
+
dependsOn;
|
|
12
|
+
timeout;
|
|
13
|
+
retryConfig;
|
|
14
|
+
constructor(definition) {
|
|
15
|
+
const config = definition.config;
|
|
16
|
+
this.id = definition.id;
|
|
17
|
+
this.methodName = config._methodName;
|
|
18
|
+
this.instance = config._instance;
|
|
19
|
+
this.dependsOn = definition.depends_on || [];
|
|
20
|
+
this.timeout = definition.timeout;
|
|
21
|
+
this.retryConfig = definition.retry;
|
|
22
|
+
}
|
|
23
|
+
async execute(context) {
|
|
24
|
+
const startTime = Date.now();
|
|
25
|
+
const method = this.instance[this.methodName];
|
|
26
|
+
if (typeof method !== "function") {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
error: `Method '${this.methodName}' is not a function`,
|
|
30
|
+
duration: Date.now() - startTime
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const input = this.prepareInput(context);
|
|
34
|
+
const result = await this.executeWithRetry(input, context.abort);
|
|
35
|
+
return {
|
|
36
|
+
success: !result.error,
|
|
37
|
+
output: result.output,
|
|
38
|
+
error: result.error,
|
|
39
|
+
duration: Date.now() - startTime,
|
|
40
|
+
metadata: {
|
|
41
|
+
methodName: this.methodName
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
prepareInput(context) {
|
|
46
|
+
const nodeOutputs = context.nodeOutputs;
|
|
47
|
+
if (this.dependsOn.length === 0) {
|
|
48
|
+
return context.input || {};
|
|
49
|
+
}
|
|
50
|
+
const input = {};
|
|
51
|
+
for (const depId of this.dependsOn) {
|
|
52
|
+
const depOutput = nodeOutputs instanceof Map ? nodeOutputs.get(depId) : nodeOutputs?.[depId];
|
|
53
|
+
if (depOutput && typeof depOutput === "object") {
|
|
54
|
+
if ("output" in depOutput) {
|
|
55
|
+
input[depId] = depOutput.output;
|
|
56
|
+
} else {
|
|
57
|
+
input[depId] = depOutput;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return input;
|
|
62
|
+
}
|
|
63
|
+
async executeWithRetry(input, abort) {
|
|
64
|
+
const maxAttempts = this.retryConfig?.max_attempts ?? 1;
|
|
65
|
+
const backoff = this.retryConfig?.backoff ?? "exponential";
|
|
66
|
+
const initialDelay = this.retryConfig?.initial_delay ?? 1000;
|
|
67
|
+
let lastError;
|
|
68
|
+
for (let attempt = 1;attempt <= maxAttempts; attempt++) {
|
|
69
|
+
if (abort?.aborted) {
|
|
70
|
+
return { error: "Execution aborted" };
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const output = await this.executeWithTimeout(input, abort);
|
|
74
|
+
return { output };
|
|
75
|
+
} catch (error) {
|
|
76
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
77
|
+
if (attempt < maxAttempts) {
|
|
78
|
+
const delay = this.calculateBackoff(backoff, initialDelay, attempt - 1);
|
|
79
|
+
await this.sleep(delay, abort);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { error: lastError?.message || "Unknown error" };
|
|
84
|
+
}
|
|
85
|
+
async executeWithTimeout(input, abort) {
|
|
86
|
+
if (!this.timeout) {
|
|
87
|
+
return this.instance[this.methodName](input);
|
|
88
|
+
}
|
|
89
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
reject(new Error(`Execution timeout after ${this.timeout}ms`));
|
|
92
|
+
}, this.timeout);
|
|
93
|
+
});
|
|
94
|
+
return Promise.race([
|
|
95
|
+
this.instance[this.methodName](input),
|
|
96
|
+
timeoutPromise
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
calculateBackoff(backoff, initialDelay, attempt) {
|
|
100
|
+
if (backoff === "exponential") {
|
|
101
|
+
return initialDelay * Math.pow(2, attempt);
|
|
102
|
+
}
|
|
103
|
+
return initialDelay;
|
|
104
|
+
}
|
|
105
|
+
sleep(ms, abort) {
|
|
106
|
+
return new Promise((resolve) => {
|
|
107
|
+
const timeout = setTimeout(resolve, ms);
|
|
108
|
+
abort?.addEventListener("abort", () => {
|
|
109
|
+
clearTimeout(timeout);
|
|
110
|
+
resolve();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var init_decorator_node = () => {};
|
|
116
|
+
|
|
117
|
+
export { DecoratorNode, init_decorator_node };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WorkflowRepository,
|
|
3
|
+
rowToWorkflow
|
|
4
|
+
} from "./roy-agent-core-tkr5ynkh.js";
|
|
5
|
+
import"./roy-agent-core-qxybm159.js";
|
|
6
|
+
import"./roy-agent-core-0sgn3de4.js";
|
|
7
|
+
import"./roy-agent-core-yn761yve.js";
|
|
8
|
+
import"./roy-agent-core-1k28kg7h.js";
|
|
9
|
+
import"./roy-agent-core-j8zx62zr.js";
|
|
10
|
+
import"./roy-agent-core-fs0mn2jk.js";
|
|
11
|
+
export {
|
|
12
|
+
rowToWorkflow,
|
|
13
|
+
WorkflowRepository
|
|
14
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__esm
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
4
4
|
|
|
5
|
-
// src/env/workflow/utils/session-recovery.ts
|
|
5
|
+
// packages/core/src/env/workflow/utils/session-recovery.ts
|
|
6
6
|
function inferNextNode(messages, definition) {
|
|
7
7
|
if (messages.length === 0) {
|
|
8
8
|
return { type: "entry_node", nodeId: definition.entryNode };
|