@ai-setting/roy-agent-core 1.4.13 → 1.4.15

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 (102) hide show
  1. package/dist/config/index.js +32 -0
  2. package/dist/env/agent/index.js +24 -0
  3. package/dist/env/commands/index.js +14 -0
  4. package/dist/env/debug/formatters/index.js +11 -0
  5. package/dist/env/debug/index.js +26 -0
  6. package/dist/env/hook/index.js +29 -0
  7. package/dist/env/index.js +81 -0
  8. package/dist/env/llm/index.js +40 -0
  9. package/dist/env/log-trace/index.js +83 -0
  10. package/dist/env/mcp/index.js +39 -0
  11. package/dist/env/mcp/tool/index.js +14 -0
  12. package/dist/env/memory/built-in/index.js +11 -0
  13. package/dist/env/memory/index.js +56 -0
  14. package/dist/env/memory/plugin/index.js +36 -0
  15. package/dist/env/prompt/index.js +20 -0
  16. package/dist/env/session/index.js +25 -0
  17. package/dist/env/session/storage/index.js +18 -0
  18. package/dist/env/skill/index.js +34 -0
  19. package/dist/env/skill/tool/index.js +9 -0
  20. package/dist/env/task/delegate/index.js +18 -0
  21. package/dist/env/task/hooks/index.js +7 -0
  22. package/dist/env/task/index.js +30 -0
  23. package/dist/env/task/plugins/index.js +23 -0
  24. package/dist/env/task/storage/index.js +14 -0
  25. package/dist/env/task/tools/index.js +17 -0
  26. package/dist/env/task/tools/operation/index.js +15 -0
  27. package/dist/{shared/chunk-1d4rwms4.js → env/tool/built-in/index.js} +4 -4
  28. package/dist/env/tool/index.js +39 -0
  29. package/dist/env/workflow/decorators/index.js +27 -0
  30. package/dist/env/workflow/engine/index.js +28 -0
  31. package/dist/env/workflow/index.js +132 -0
  32. package/dist/env/workflow/nodes/index.js +19 -0
  33. package/dist/env/workflow/service/index.js +13 -0
  34. package/dist/env/workflow/storage/index.js +27 -0
  35. package/dist/env/workflow/tools/index.js +159 -0
  36. package/dist/env/workflow/types/index.js +94 -0
  37. package/dist/env/workflow/utils/index.js +637 -0
  38. package/dist/index.js +233 -16386
  39. package/dist/shared/{chunk-2b5kbhx3.js → @ai-setting/roy-agent-core-0rtxwr28.js} +6 -114
  40. package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +36 -0
  41. package/dist/shared/@ai-setting/roy-agent-core-12zkpda2.js +393 -0
  42. package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +117 -0
  43. package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +11 -0
  44. package/dist/shared/@ai-setting/roy-agent-core-2kg2wma8.js +620 -0
  45. package/dist/shared/@ai-setting/roy-agent-core-2x0m2p66.js +851 -0
  46. package/dist/shared/@ai-setting/roy-agent-core-35x0wrtt.js +172 -0
  47. package/dist/shared/{chunk-1pf5mfgd.js → @ai-setting/roy-agent-core-37e4tep3.js} +2 -2
  48. package/dist/shared/@ai-setting/roy-agent-core-3agad0d9.js +603 -0
  49. package/dist/shared/@ai-setting/roy-agent-core-4arba14a.js +419 -0
  50. package/dist/shared/@ai-setting/roy-agent-core-4rqmfr7t.js +266 -0
  51. package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +206 -0
  52. package/dist/shared/@ai-setting/roy-agent-core-561b1c4p.js +377 -0
  53. package/dist/shared/@ai-setting/roy-agent-core-5xf65pz6.js +1305 -0
  54. package/dist/shared/@ai-setting/roy-agent-core-6a72jfdy.js +303 -0
  55. package/dist/shared/{chunk-1aakcfp1.js → @ai-setting/roy-agent-core-7f303ffd.js} +3 -3
  56. package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +284 -0
  57. package/dist/shared/{chunk-t1rh6jtm.js → @ai-setting/roy-agent-core-7n436rb4.js} +7 -12
  58. package/dist/shared/@ai-setting/roy-agent-core-7r85t0qn.js +492 -0
  59. package/dist/shared/@ai-setting/roy-agent-core-7rewcey6.js +862 -0
  60. package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +14 -0
  61. package/dist/shared/@ai-setting/roy-agent-core-9qwp5qkz.js +1387 -0
  62. package/dist/shared/{chunk-mf5xqbdh.js → @ai-setting/roy-agent-core-9yxb3ty9.js} +3 -2
  63. package/dist/shared/@ai-setting/roy-agent-core-anwsxdds.js +1205 -0
  64. package/dist/shared/{chunk-1qwabsm0.js → @ai-setting/roy-agent-core-bncgx3gb.js} +1 -1
  65. package/dist/shared/@ai-setting/roy-agent-core-cd00w5mb.js +762 -0
  66. package/dist/shared/@ai-setting/roy-agent-core-cgs0j60t.js +442 -0
  67. package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +93 -0
  68. package/dist/shared/@ai-setting/roy-agent-core-dbsk841j.js +286 -0
  69. package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +64 -0
  70. package/dist/shared/{chunk-yqmx37vm.js → @ai-setting/roy-agent-core-e5jcp24a.js} +2 -2
  71. package/dist/shared/@ai-setting/roy-agent-core-e62e2a5a.js +204 -0
  72. package/dist/shared/{chunk-g6j5n3gv.js → @ai-setting/roy-agent-core-ewrj1c4k.js} +2 -2
  73. package/dist/shared/{chunk-rncy3rtd.js → @ai-setting/roy-agent-core-fdb6m4e4.js} +119 -1113
  74. package/dist/shared/{chunk-q9j99fsm.js → @ai-setting/roy-agent-core-fv32jaa8.js} +3 -3
  75. package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +171 -0
  76. package/dist/shared/@ai-setting/roy-agent-core-gmnkza34.js +202 -0
  77. package/dist/shared/@ai-setting/roy-agent-core-hz7rr4yx.js +513 -0
  78. package/dist/shared/@ai-setting/roy-agent-core-j3bbr2n0.js +378 -0
  79. package/dist/shared/{chunk-a9qmy3sc.js → @ai-setting/roy-agent-core-j3wc4465.js} +6 -3
  80. package/dist/shared/@ai-setting/roy-agent-core-jj79gszx.js +1130 -0
  81. package/dist/shared/@ai-setting/roy-agent-core-mwwk6req.js +913 -0
  82. package/dist/shared/{chunk-0q6s9wm6.js → @ai-setting/roy-agent-core-pc9g3962.js} +6 -50
  83. package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +60 -0
  84. package/dist/shared/@ai-setting/roy-agent-core-pzsg9pvf.js +393 -0
  85. package/dist/shared/{chunk-91bas8w5.js → @ai-setting/roy-agent-core-q779wnwm.js} +5 -5
  86. package/dist/shared/{chunk-25x2pdtp.js → @ai-setting/roy-agent-core-qw0ebh1d.js} +1 -1
  87. package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +57 -0
  88. package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +66 -0
  89. package/dist/shared/@ai-setting/roy-agent-core-qya7seh6.js +408 -0
  90. package/dist/shared/@ai-setting/roy-agent-core-rbetrphj.js +97 -0
  91. package/dist/shared/@ai-setting/roy-agent-core-re1wjfw7.js +587 -0
  92. package/dist/shared/@ai-setting/roy-agent-core-rft3fmp0.js +14 -0
  93. package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +584 -0
  94. package/dist/shared/{chunk-ze20rksg.js → @ai-setting/roy-agent-core-rvxg1wps.js} +1 -1
  95. package/dist/shared/@ai-setting/roy-agent-core-rzp9kxne.js +341 -0
  96. package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +213 -0
  97. package/dist/shared/@ai-setting/roy-agent-core-w78syn7w.js +788 -0
  98. package/dist/shared/{chunk-9qzt1v1p.js → @ai-setting/roy-agent-core-z2t8hse8.js} +3 -2
  99. package/package.json +8 -7
  100. package/dist/index.d.ts +0 -7825
  101. package/dist/shared/chunk-hs7tbmje.js +0 -24
  102. /package/dist/shared/{chunk-wbkh7wat.js → @ai-setting/roy-agent-core-fs0mn2jk.js} +0 -0
@@ -0,0 +1,172 @@
1
+ import {
2
+ createLogger,
3
+ getMaxOutput,
4
+ init_logger,
5
+ simplifyFilePath
6
+ } from "./roy-agent-core-j3wc4465.js";
7
+ import {
8
+ getTracerProvider,
9
+ init_tracer_provider
10
+ } from "./roy-agent-core-fv32jaa8.js";
11
+ import {
12
+ __esm
13
+ } from "./roy-agent-core-fs0mn2jk.js";
14
+
15
+ // src/env/log-trace/decorator.ts
16
+ function Traced(options) {
17
+ return function(target, propertyKey, descriptor) {
18
+ const originalFn = descriptor.value;
19
+ const spanName = options?.name || propertyKey;
20
+ descriptor.value = wrapFunction(originalFn, spanName, {
21
+ recordParams: options?.recordParams ?? true,
22
+ recordResult: options?.recordResult ?? false,
23
+ recordError: options?.recordError ?? true,
24
+ log: options?.log ?? false,
25
+ maxLogSize: options?.maxLogSize,
26
+ paramFilter: options?.paramFilter
27
+ });
28
+ return descriptor;
29
+ };
30
+ }
31
+ function TracedAs(name, options) {
32
+ return Traced({ name, ...options });
33
+ }
34
+ function TracedLightweight(options) {
35
+ return Traced({ recordParams: false, recordResult: false, log: options?.log ?? false, maxLogSize: options?.maxLogSize });
36
+ }
37
+ function wrapFunction(fn, name, options) {
38
+ const shouldLog = options?.log ?? false;
39
+ const getMaxLogSize = () => {
40
+ if (options?.maxLogSize !== undefined) {
41
+ return options.maxLogSize;
42
+ }
43
+ const configMaxOutput = getMaxOutput();
44
+ return configMaxOutput !== undefined ? configMaxOutput : 500;
45
+ };
46
+ const truncate = (obj) => {
47
+ if (obj === undefined)
48
+ return;
49
+ if (obj === null)
50
+ return null;
51
+ const maxLogSize = getMaxLogSize();
52
+ let str;
53
+ try {
54
+ str = typeof obj === "string" ? obj : JSON.stringify(obj, null, 0).replace(/\n/g, "");
55
+ } catch (e) {
56
+ str = `[Object with circular reference: ${e instanceof Error ? e.message : String(e)}]`;
57
+ }
58
+ if (maxLogSize > 0 && str.length > maxLogSize) {
59
+ return str.slice(0, maxLogSize) + " [TRUNCATED]";
60
+ }
61
+ try {
62
+ return JSON.parse(str);
63
+ } catch {
64
+ return str;
65
+ }
66
+ };
67
+ const truncateString = (obj) => {
68
+ if (obj === undefined)
69
+ return "undefined";
70
+ if (obj === null)
71
+ return "null";
72
+ const maxLogSize = getMaxLogSize();
73
+ let str;
74
+ try {
75
+ str = typeof obj === "string" ? obj : JSON.stringify(obj, null, 0).replace(/\n/g, "");
76
+ } catch (e) {
77
+ str = `[Object with circular reference: ${e instanceof Error ? e.message : String(e)}]`;
78
+ }
79
+ return maxLogSize > 0 && str.length > maxLogSize ? str.slice(0, maxLogSize) + " [TRUNCATED]" : str;
80
+ };
81
+ const TRACE_LOG_PREFIX = "[TRACE]";
82
+ const getCallerLocation = () => {
83
+ const originalLimit = Error.stackTraceLimit;
84
+ Error.stackTraceLimit = 15;
85
+ const err = new Error;
86
+ Error.captureStackTrace(err, getCallerLocation);
87
+ const stack = err.stack?.split(`
88
+ `) || [];
89
+ Error.stackTraceLimit = originalLimit;
90
+ for (let i = 1;i < stack.length; i++) {
91
+ const line = stack[i];
92
+ if (line.includes("decorator.ts") || line.includes("decorator.js") || line.includes("logFn") || line.includes("getCallerLocation"))
93
+ continue;
94
+ const match = line.match(/at\s+.+\s+\((.+):(\d+):\d+\)/) || line.match(/at\s+(.+):(\d+):\d+/);
95
+ if (match) {
96
+ const filePath = match[1];
97
+ if (!filePath || filePath === "native")
98
+ continue;
99
+ const relativePath = simplifyFilePath(filePath);
100
+ return `${relativePath}:${match[2]}`;
101
+ }
102
+ }
103
+ return "";
104
+ };
105
+ const logFn = (event, argsOrData, callerLocation) => {
106
+ if (!shouldLog)
107
+ return;
108
+ const logger = createLogger("traced:" + name);
109
+ const tag = event === "enter" ? ">>>" : event === "quit" ? "<<<" : "!!!";
110
+ const prefix = `${TRACE_LOG_PREFIX} ${tag} ${name}`;
111
+ const originalFnLocation = callerLocation || getCallerLocation();
112
+ const logMessage = (msg, data) => {
113
+ if (data !== undefined) {
114
+ logger.info(`${prefix} ${msg}: ${truncateString(data)}`, { callerLocation: originalFnLocation });
115
+ } else {
116
+ logger.info(`${prefix} ${msg}`, { callerLocation: originalFnLocation });
117
+ }
118
+ };
119
+ if (event === "enter") {
120
+ logMessage("enter", argsOrData);
121
+ } else if (event === "quit") {
122
+ logMessage("quit", options?.recordResult ? argsOrData : undefined);
123
+ } else {
124
+ logMessage("error", argsOrData);
125
+ }
126
+ };
127
+ return function(...args) {
128
+ const tracer = getTracerProvider().getTracer("roy-tracer");
129
+ const attributes = {};
130
+ if (options?.recordParams !== false) {
131
+ if (options?.paramFilter) {
132
+ attributes["params"] = truncate(options.paramFilter(args));
133
+ } else {
134
+ attributes["params"] = truncate(args);
135
+ }
136
+ }
137
+ const callerLocation = getCallerLocation();
138
+ logFn("enter", args, callerLocation);
139
+ const span = tracer.startSpan(name, { attributes });
140
+ try {
141
+ const result = fn.call(this, ...args);
142
+ if (result && typeof result === "object" && typeof result.then === "function") {
143
+ return result.then((resolved) => {
144
+ span.setAttribute("result", JSON.stringify(truncate(resolved)));
145
+ span.end(resolved);
146
+ logFn("quit", options?.recordResult ? resolved : undefined, callerLocation);
147
+ return resolved;
148
+ }, (rejected) => {
149
+ span.setAttribute("error", String(rejected));
150
+ span.end(undefined, rejected instanceof Error ? rejected : new Error(String(rejected)));
151
+ logFn("error", rejected.message, callerLocation);
152
+ throw rejected;
153
+ });
154
+ }
155
+ span.setAttribute("result", JSON.stringify(truncate(result)));
156
+ span.end(result);
157
+ logFn("quit", options?.recordResult ? result : undefined, callerLocation);
158
+ return result;
159
+ } catch (error) {
160
+ span.setAttribute("error", String(error));
161
+ span.end(undefined, error instanceof Error ? error : new Error(String(error)));
162
+ logFn("error", error.message, callerLocation);
163
+ throw error;
164
+ }
165
+ };
166
+ }
167
+ var init_decorator = __esm(() => {
168
+ init_tracer_provider();
169
+ init_logger();
170
+ });
171
+
172
+ export { Traced, TracedAs, TracedLightweight, wrapFunction, init_decorator };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createLogger,
3
3
  init_logger
4
- } from "./chunk-a9qmy3sc.js";
4
+ } from "./roy-agent-core-j3wc4465.js";
5
5
  import {
6
6
  __require
7
- } from "./chunk-wbkh7wat.js";
7
+ } from "./roy-agent-core-fs0mn2jk.js";
8
8
 
9
9
  // src/env/workflow/storage/sqlite.ts
10
10
  init_logger();