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

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 (57) hide show
  1. package/dist/index.d.ts +7825 -0
  2. package/dist/index.js +13073 -19300
  3. package/dist/shared/chunk-0q6s9wm6.js +249 -0
  4. package/dist/shared/chunk-1aakcfp1.js +15 -0
  5. package/dist/shared/chunk-1d4rwms4.js +25 -0
  6. package/dist/shared/chunk-1pf5mfgd.js +82 -0
  7. package/dist/shared/chunk-1qwabsm0.js +154 -0
  8. package/dist/shared/chunk-25x2pdtp.js +107 -0
  9. package/dist/shared/chunk-2b5kbhx3.js +366 -0
  10. package/dist/shared/chunk-91bas8w5.js +20 -0
  11. package/dist/shared/chunk-9qzt1v1p.js +10 -0
  12. package/dist/shared/chunk-a9qmy3sc.js +296 -0
  13. package/dist/shared/chunk-g6j5n3gv.js +549 -0
  14. package/dist/shared/chunk-hs7tbmje.js +24 -0
  15. package/dist/shared/chunk-mf5xqbdh.js +14 -0
  16. package/dist/shared/chunk-q9j99fsm.js +368 -0
  17. package/dist/{env/workflow/engine/index.js → shared/chunk-rncy3rtd.js} +330 -1581
  18. package/dist/shared/chunk-t1rh6jtm.js +205 -0
  19. package/dist/{env/task/hooks/index.js → shared/chunk-wbkh7wat.js} +3 -18
  20. package/dist/shared/chunk-yqmx37vm.js +10 -0
  21. package/dist/shared/chunk-ze20rksg.js +102 -0
  22. package/package.json +7 -7
  23. package/dist/config/index.js +0 -1670
  24. package/dist/env/agent/index.js +0 -3035
  25. package/dist/env/commands/index.js +0 -1685
  26. package/dist/env/debug/formatters/index.js +0 -639
  27. package/dist/env/debug/index.js +0 -2300
  28. package/dist/env/hook/index.js +0 -273
  29. package/dist/env/index.js +0 -12591
  30. package/dist/env/llm/index.js +0 -2736
  31. package/dist/env/log-trace/index.js +0 -1779
  32. package/dist/env/mcp/index.js +0 -2173
  33. package/dist/env/mcp/tool/index.js +0 -1149
  34. package/dist/env/memory/built-in/index.js +0 -225
  35. package/dist/env/memory/index.js +0 -2171
  36. package/dist/env/memory/plugin/index.js +0 -1263
  37. package/dist/env/prompt/index.js +0 -2107
  38. package/dist/env/session/index.js +0 -3594
  39. package/dist/env/session/storage/index.js +0 -2049
  40. package/dist/env/skill/index.js +0 -1635
  41. package/dist/env/skill/tool/index.js +0 -114
  42. package/dist/env/task/delegate/index.js +0 -1844
  43. package/dist/env/task/index.js +0 -3578
  44. package/dist/env/task/plugins/index.js +0 -1626
  45. package/dist/env/task/storage/index.js +0 -1464
  46. package/dist/env/task/tools/index.js +0 -344
  47. package/dist/env/task/tools/operation/index.js +0 -270
  48. package/dist/env/tool/built-in/index.js +0 -1151
  49. package/dist/env/tool/index.js +0 -2284
  50. package/dist/env/workflow/decorators/index.js +0 -449
  51. package/dist/env/workflow/index.js +0 -6214
  52. package/dist/env/workflow/nodes/index.js +0 -650
  53. package/dist/env/workflow/service/index.js +0 -262
  54. package/dist/env/workflow/storage/index.js +0 -1236
  55. package/dist/env/workflow/tools/index.js +0 -1081
  56. package/dist/env/workflow/types/index.js +0 -479
  57. package/dist/env/workflow/utils/index.js +0 -1631
@@ -1,262 +0,0 @@
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/service/workflow-service.ts
53
- class WorkflowService {
54
- workflowRepository;
55
- engineFactory;
56
- sessionComponent;
57
- constructor(workflowRepository, engineFactory, sessionComponent) {
58
- this.workflowRepository = workflowRepository;
59
- this.engineFactory = engineFactory;
60
- this.sessionComponent = sessionComponent;
61
- }
62
- async createWorkflow(definition, options) {
63
- const existing = this.workflowRepository.getByName(definition.name);
64
- if (existing) {
65
- if (options?.force !== true) {
66
- throw new Error(`Workflow already exists: ${definition.name}`);
67
- }
68
- return this.workflowRepository.update(existing.id, {
69
- name: definition.name,
70
- version: definition.version,
71
- description: definition.description || existing.description,
72
- definition,
73
- config: definition.config || {},
74
- metadata: {
75
- ...options.metadata || definition.metadata || existing.metadata || {},
76
- taskId: options.taskId || definition.metadata?.taskId || existing.metadata?.taskId
77
- },
78
- tags: options.tags || definition.metadata?.tags || []
79
- });
80
- }
81
- const workflow = {
82
- name: definition.name,
83
- version: definition.version,
84
- description: definition.description,
85
- definition,
86
- config: definition.config || {},
87
- metadata: {
88
- ...options?.metadata || definition.metadata || {},
89
- taskId: options?.taskId || definition.metadata?.taskId
90
- },
91
- tags: options?.tags || definition.metadata?.tags || []
92
- };
93
- return this.workflowRepository.create(workflow);
94
- }
95
- getWorkflow(idOrName) {
96
- let workflow = this.workflowRepository.getById(idOrName);
97
- if (workflow)
98
- return workflow;
99
- return this.workflowRepository.getByName(idOrName);
100
- }
101
- getWorkflowById(id) {
102
- return this.workflowRepository.getById(id);
103
- }
104
- getWorkflowByName(name) {
105
- return this.workflowRepository.getByName(name);
106
- }
107
- listWorkflows(options) {
108
- return this.workflowRepository.list(options);
109
- }
110
- async updateWorkflow(idOrName, updates, options) {
111
- let workflow = this.workflowRepository.getByName(idOrName);
112
- if (!workflow) {
113
- workflow = this.workflowRepository.getById(idOrName);
114
- }
115
- if (!workflow) {
116
- throw new Error(`Workflow not found: ${idOrName}`);
117
- }
118
- const updateData = {
119
- ...updates
120
- };
121
- if (options?.tags !== undefined) {
122
- updateData.tags = options.tags;
123
- }
124
- const updated = this.workflowRepository.update(workflow.id, updateData);
125
- if (!updated) {
126
- throw new Error(`Failed to update workflow: ${idOrName}`);
127
- }
128
- return updated;
129
- }
130
- async deleteWorkflow(idOrName) {
131
- let workflow = this.workflowRepository.getByName(idOrName);
132
- if (!workflow) {
133
- workflow = this.workflowRepository.getById(idOrName);
134
- }
135
- if (!workflow) {
136
- return false;
137
- }
138
- return this.workflowRepository.delete(workflow.id);
139
- }
140
- async runWorkflow(idOrNameOrDefinition, input, options) {
141
- let workflow = null;
142
- let definition = null;
143
- if (typeof idOrNameOrDefinition === "string") {
144
- workflow = this.getWorkflow(idOrNameOrDefinition);
145
- if (!workflow) {
146
- throw new Error(`Workflow not found: ${idOrNameOrDefinition}`);
147
- }
148
- definition = workflow.definition;
149
- } else {
150
- definition = idOrNameOrDefinition;
151
- workflow = this.getWorkflowByName(definition.name);
152
- if (!workflow) {
153
- workflow = {
154
- id: `wf_inline_${definition.name}`,
155
- name: definition.name,
156
- version: definition.version,
157
- description: definition.description,
158
- definition,
159
- config: definition.config || {},
160
- metadata: definition.metadata || {},
161
- tags: definition.metadata?.tags || [],
162
- createdAt: new Date,
163
- updatedAt: new Date
164
- };
165
- }
166
- }
167
- const engine = this.engineFactory(workflow, {
168
- ...options,
169
- input
170
- });
171
- const result = await engine.runWorkflow(workflow, {
172
- ...options,
173
- input
174
- });
175
- return {
176
- ...result,
177
- runId: result.runId || result.sessionId || "",
178
- sessionId: result.sessionId || result.runId || ""
179
- };
180
- }
181
- async runWorkflowByName(name, input, options) {
182
- const workflow = this.getWorkflowByName(name);
183
- if (!workflow) {
184
- throw new Error(`Workflow not found: ${name}`);
185
- }
186
- return this.runWorkflow(name, input, options);
187
- }
188
- async stopRun(sessionId, reason) {
189
- const session = await this.sessionComponent?.get(sessionId);
190
- if (!session) {
191
- throw new Error(`Session not found: ${sessionId}`);
192
- }
193
- const metadata = session.metadata;
194
- if (metadata.type !== "workflow") {
195
- throw new Error(`Session is not a workflow session: ${sessionId}`);
196
- }
197
- const workflow = this.getWorkflowByName(metadata.workflowName);
198
- if (!workflow) {
199
- throw new Error(`Workflow not found: ${metadata.workflowName}`);
200
- }
201
- const engine = this.engineFactory(workflow);
202
- await engine.stop(sessionId, reason);
203
- }
204
- async getSession(sessionId) {
205
- if (!this.sessionComponent) {
206
- return null;
207
- }
208
- const session = await this.sessionComponent.get(sessionId);
209
- return session ?? null;
210
- }
211
- async listSessions(options) {
212
- if (!this.sessionComponent?.list) {
213
- return [];
214
- }
215
- return this.sessionComponent.list(options);
216
- }
217
- async getSessionMessages(sessionId) {
218
- if (!this.sessionComponent) {
219
- return [];
220
- }
221
- return this.sessionComponent.getMessages(sessionId);
222
- }
223
- }
224
- // packages/core/src/env/workflow/service/registry.ts
225
- class WorkflowServiceRegistry {
226
- static instance;
227
- service = null;
228
- constructor() {}
229
- static getInstance() {
230
- if (!WorkflowServiceRegistry.instance) {
231
- WorkflowServiceRegistry.instance = new WorkflowServiceRegistry;
232
- }
233
- return WorkflowServiceRegistry.instance;
234
- }
235
- register(service) {
236
- this.service = service;
237
- }
238
- get() {
239
- if (!this.service) {
240
- throw new Error("WorkflowService is not registered. Call register() first.");
241
- }
242
- return this.service;
243
- }
244
- isRegistered() {
245
- return this.service !== null;
246
- }
247
- reset() {
248
- this.service = null;
249
- }
250
- }
251
- function getWorkflowService() {
252
- return WorkflowServiceRegistry.getInstance().get();
253
- }
254
- function registerWorkflowService(service) {
255
- WorkflowServiceRegistry.getInstance().register(service);
256
- }
257
- export {
258
- registerWorkflowService,
259
- getWorkflowService,
260
- WorkflowServiceRegistry,
261
- WorkflowService
262
- };