@ai-setting/roy-agent-core 1.5.16-test → 1.5.22
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/env/index.js +20 -8
- package/dist/env/log-trace/index.js +1 -1
- package/dist/env/prompt/index.js +1 -1
- package/dist/env/workflow/engine/index.js +1 -1
- package/dist/env/workflow/index.js +2 -2
- package/dist/index.js +6 -7
- package/dist/shared/@ai-setting/{roy-agent-core-xq8hhqb8.js → roy-agent-core-4wjywp3c.js} +4 -2
- package/dist/shared/@ai-setting/roy-agent-core-8jxva565.js +19 -0
- package/dist/shared/@ai-setting/roy-agent-core-avq1x4t7.js +84 -0
- package/dist/shared/@ai-setting/{roy-agent-core-gq20wsgv.js → roy-agent-core-ffb9fq4v.js} +23 -2
- package/dist/shared/@ai-setting/{roy-agent-core-93zfb3r1.js → roy-agent-core-mrcxzpbg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rhmtwnw1.js → roy-agent-core-pw7cv1px.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gbqcyegm.js → roy-agent-core-rccptwv0.js} +512 -673
- package/dist/shared/@ai-setting/{roy-agent-core-wrcy0h6z.js → roy-agent-core-ty94k28r.js} +1 -1
- package/package.json +1 -1
- package/dist/config/index.d.ts +0 -1250
- package/dist/env/agent/index.d.ts +0 -2279
- package/dist/env/commands/index.d.ts +0 -1131
- package/dist/env/debug/formatters/index.d.ts +0 -236
- package/dist/env/debug/index.d.ts +0 -1652
- package/dist/env/hook/index.d.ts +0 -279
- package/dist/env/index.d.ts +0 -3481
- package/dist/env/llm/index.d.ts +0 -1760
- package/dist/env/log-trace/index.d.ts +0 -1574
- package/dist/env/mcp/index.d.ts +0 -1331
- package/dist/env/mcp/tool/index.d.ts +0 -183
- package/dist/env/memory/built-in/index.d.ts +0 -232
- package/dist/env/memory/index.d.ts +0 -1799
- package/dist/env/memory/plugin/index.d.ts +0 -747
- package/dist/env/prompt/index.d.ts +0 -1164
- package/dist/env/session/index.d.ts +0 -1908
- package/dist/env/session/storage/index.d.ts +0 -564
- package/dist/env/skill/index.d.ts +0 -1266
- package/dist/env/skill/tool/index.d.ts +0 -193
- package/dist/env/task/delegate/index.d.ts +0 -1612
- package/dist/env/task/events/index.d.ts +0 -171
- package/dist/env/task/hooks/index.d.ts +0 -624
- package/dist/env/task/index.d.ts +0 -1553
- package/dist/env/task/plugins/index.d.ts +0 -466
- package/dist/env/task/storage/index.d.ts +0 -241
- package/dist/env/task/tools/index.d.ts +0 -1485
- package/dist/env/task/tools/operation/index.d.ts +0 -1484
- package/dist/env/tool/built-in/index.d.ts +0 -218
- package/dist/env/tool/index.d.ts +0 -1396
- package/dist/env/workflow/decorators/index.d.ts +0 -2161
- package/dist/env/workflow/engine/index.d.ts +0 -3453
- package/dist/env/workflow/index.d.ts +0 -3546
- package/dist/env/workflow/nodes/index.d.ts +0 -2092
- package/dist/env/workflow/service/index.d.ts +0 -227
- package/dist/env/workflow/storage/index.d.ts +0 -165
- package/dist/env/workflow/tools/index.d.ts +0 -416
- package/dist/env/workflow/types/index.d.ts +0 -2255
- package/dist/env/workflow/utils/index.d.ts +0 -2031
- package/dist/index.d.ts +0 -7858
package/dist/env/index.js
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment,
|
|
3
|
-
EventSourceAgentHandler,
|
|
4
3
|
EventSourceComponent,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
builtInHandlers,
|
|
5
|
+
larkCliHandler,
|
|
6
|
+
timerHandler,
|
|
7
|
+
websocketHandler
|
|
8
|
+
} from "../shared/@ai-setting/roy-agent-core-rccptwv0.js";
|
|
9
9
|
import {
|
|
10
10
|
XDG_PATHS,
|
|
11
11
|
getXDGPath,
|
|
12
12
|
getXDGPaths
|
|
13
13
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
14
|
+
import {
|
|
15
|
+
EventSourceInitHooks,
|
|
16
|
+
getDefaultConfigForType,
|
|
17
|
+
isBuiltInEventSourceType,
|
|
18
|
+
isValidEventSourceType,
|
|
19
|
+
validateEventSourceConfig
|
|
20
|
+
} from "../shared/@ai-setting/roy-agent-core-avq1x4t7.js";
|
|
14
21
|
import {
|
|
15
22
|
WorkflowComponent
|
|
16
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
23
|
+
} from "../shared/@ai-setting/roy-agent-core-pw7cv1px.js";
|
|
17
24
|
import"../shared/@ai-setting/roy-agent-core-0rtxwr28.js";
|
|
18
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
25
|
+
import"../shared/@ai-setting/roy-agent-core-ty94k28r.js";
|
|
19
26
|
import"../shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
20
27
|
import"../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
21
28
|
import"../shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
@@ -61,20 +68,25 @@ import"../shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
|
61
68
|
import"../shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
62
69
|
import"../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
63
70
|
export {
|
|
71
|
+
websocketHandler,
|
|
64
72
|
validateEventSourceConfig,
|
|
73
|
+
timerHandler,
|
|
74
|
+
larkCliHandler,
|
|
65
75
|
isValidEventSourceType,
|
|
76
|
+
isBuiltInEventSourceType,
|
|
66
77
|
getXDGPaths,
|
|
67
78
|
getXDGPath,
|
|
68
79
|
getDefaultConfigForType,
|
|
69
80
|
createPriorityHook,
|
|
70
81
|
createHook,
|
|
82
|
+
builtInHandlers,
|
|
71
83
|
XDG_PATHS,
|
|
72
84
|
WorkflowComponent,
|
|
73
85
|
TaskComponent,
|
|
74
86
|
McpComponent,
|
|
75
87
|
HookManager,
|
|
88
|
+
EventSourceInitHooks,
|
|
76
89
|
EventSourceComponent,
|
|
77
|
-
EventSourceAgentHandler,
|
|
78
90
|
BaseEnvironment,
|
|
79
91
|
BaseComponent,
|
|
80
92
|
AgentComponentConfigSchema,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
injectToEnv,
|
|
8
8
|
injectToEnvFromCarrier,
|
|
9
9
|
injectToEnvWithContext
|
|
10
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-4wjywp3c.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-kkbwepqb.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-2dhd60aw.js";
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-mrcxzpbg.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-kkbwepqb.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-2dhd60aw.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Scheduler,
|
|
7
7
|
WorkflowEngine,
|
|
8
8
|
init_engine
|
|
9
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "../../../shared/@ai-setting/roy-agent-core-ty94k28r.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
11
11
|
import"../../../shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-5x94xmt6.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-pw7cv1px.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-0rtxwr28.js";
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-ty94k28r.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
LogTraceComponent,
|
|
6
6
|
LogTraceConfigSchema
|
|
7
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "./shared/@ai-setting/roy-agent-core-4wjywp3c.js";
|
|
8
8
|
import {
|
|
9
9
|
ToolComponent,
|
|
10
10
|
ToolRegistry,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
PromptComponent,
|
|
25
25
|
getBuiltInPrompt,
|
|
26
26
|
getBuiltInPromptNames
|
|
27
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
27
|
+
} from "./shared/@ai-setting/roy-agent-core-mrcxzpbg.js";
|
|
28
28
|
import {
|
|
29
29
|
LLMComponent,
|
|
30
30
|
LLMConfigSchema,
|
|
@@ -62,24 +62,24 @@ import {
|
|
|
62
62
|
} from "./shared/@ai-setting/roy-agent-core-rvv6ydff.js";
|
|
63
63
|
import {
|
|
64
64
|
BaseEnvironment,
|
|
65
|
-
EventSourceAgentHandler,
|
|
66
65
|
EventSourceComponent,
|
|
67
66
|
generateDescendingId,
|
|
68
67
|
generateId
|
|
69
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
68
|
+
} from "./shared/@ai-setting/roy-agent-core-rccptwv0.js";
|
|
70
69
|
import {
|
|
71
70
|
XDG_PATHS,
|
|
72
71
|
getXDGPath,
|
|
73
72
|
getXDGPaths
|
|
74
73
|
} from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
74
|
+
import"./shared/@ai-setting/roy-agent-core-avq1x4t7.js";
|
|
75
75
|
import {
|
|
76
76
|
WorkflowComponent
|
|
77
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
77
|
+
} from "./shared/@ai-setting/roy-agent-core-pw7cv1px.js";
|
|
78
78
|
import {
|
|
79
79
|
init_node_registry_helper,
|
|
80
80
|
registerDecoratorNodeType
|
|
81
81
|
} from "./shared/@ai-setting/roy-agent-core-0rtxwr28.js";
|
|
82
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
82
|
+
import"./shared/@ai-setting/roy-agent-core-ty94k28r.js";
|
|
83
83
|
import"./shared/@ai-setting/roy-agent-core-69jskqjg.js";
|
|
84
84
|
import"./shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
85
85
|
import"./shared/@ai-setting/roy-agent-core-jvatggbb.js";
|
|
@@ -382,7 +382,6 @@ export {
|
|
|
382
382
|
LLMComponent,
|
|
383
383
|
HookManager,
|
|
384
384
|
EventSourceComponent,
|
|
385
|
-
EventSourceAgentHandler,
|
|
386
385
|
ErrorCodes,
|
|
387
386
|
Edge,
|
|
388
387
|
DebugComponent,
|
|
@@ -338,9 +338,11 @@ class LogTraceComponent extends BaseComponent {
|
|
|
338
338
|
return new SQLiteSpanStorage(getDefaultSpanDbPath());
|
|
339
339
|
}
|
|
340
340
|
configureLogging() {
|
|
341
|
-
if (!this.config?.logging)
|
|
341
|
+
if (!this.config?.logging) {
|
|
342
|
+
setQuietMode(true);
|
|
342
343
|
return;
|
|
343
|
-
|
|
344
|
+
}
|
|
345
|
+
if (this.config.logging.quiet !== false) {
|
|
344
346
|
setQuietMode(true);
|
|
345
347
|
}
|
|
346
348
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
3
|
+
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
4
|
+
EventSourceInitHooks,
|
|
5
|
+
getDefaultConfigForType,
|
|
6
|
+
isBuiltInEventSourceType,
|
|
7
|
+
isValidEventSourceType,
|
|
8
|
+
validateEventSourceConfig
|
|
9
|
+
} from "./roy-agent-core-avq1x4t7.js";
|
|
10
|
+
import"./roy-agent-core-fs0mn2jk.js";
|
|
11
|
+
export {
|
|
12
|
+
validateEventSourceConfig,
|
|
13
|
+
isValidEventSourceType,
|
|
14
|
+
isBuiltInEventSourceType,
|
|
15
|
+
getDefaultConfigForType,
|
|
16
|
+
EventSourceInitHooks,
|
|
17
|
+
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
18
|
+
BUILT_IN_EVENT_SOURCE_TYPES
|
|
19
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/env/event-source/types.ts
|
|
2
|
+
var BUILT_IN_EVENT_SOURCE_TYPES = {
|
|
3
|
+
LARK_CLI: "lark-cli",
|
|
4
|
+
WEBSOCKET: "websocket",
|
|
5
|
+
TIMER: "timer",
|
|
6
|
+
HTTP_WEBHOOK: "http-webhook",
|
|
7
|
+
FILE_WATCHER: "file-watcher"
|
|
8
|
+
};
|
|
9
|
+
var BUILT_IN_EVENT_SOURCE_TYPE_LIST = Object.values(BUILT_IN_EVENT_SOURCE_TYPES);
|
|
10
|
+
|
|
11
|
+
class EventSourceInitHooks {
|
|
12
|
+
static hooks = new Map;
|
|
13
|
+
static register(name, hook) {
|
|
14
|
+
this.hooks.set(name, hook);
|
|
15
|
+
}
|
|
16
|
+
static unregister(name) {
|
|
17
|
+
this.hooks.delete(name);
|
|
18
|
+
}
|
|
19
|
+
static list() {
|
|
20
|
+
return new Map(this.hooks);
|
|
21
|
+
}
|
|
22
|
+
static async execute(component) {
|
|
23
|
+
for (const [name, hook] of this.hooks) {
|
|
24
|
+
try {
|
|
25
|
+
await hook(component);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
process.stderr.write(`[EventSourceInitHooks] Failed to execute hook "${name}": ${error}
|
|
28
|
+
`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static clear() {
|
|
33
|
+
this.hooks.clear();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function isBuiltInEventSourceType(type) {
|
|
37
|
+
return BUILT_IN_EVENT_SOURCE_TYPE_LIST.includes(type);
|
|
38
|
+
}
|
|
39
|
+
function isValidEventSourceType(type) {
|
|
40
|
+
return isBuiltInEventSourceType(type);
|
|
41
|
+
}
|
|
42
|
+
function getDefaultConfigForType(type) {
|
|
43
|
+
switch (type) {
|
|
44
|
+
case BUILT_IN_EVENT_SOURCE_TYPES.TIMER:
|
|
45
|
+
return { interval: 60000 };
|
|
46
|
+
case BUILT_IN_EVENT_SOURCE_TYPES.LARK_CLI:
|
|
47
|
+
return { command: "lark-cli event +subscribe" };
|
|
48
|
+
case BUILT_IN_EVENT_SOURCE_TYPES.WEBSOCKET:
|
|
49
|
+
return {};
|
|
50
|
+
default:
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function validateEventSourceConfig(config, handler) {
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (!config.id) {
|
|
57
|
+
errors.push("EventSource ID is required");
|
|
58
|
+
}
|
|
59
|
+
if (!config.name) {
|
|
60
|
+
errors.push("EventSource name is required");
|
|
61
|
+
}
|
|
62
|
+
if (!config.type) {
|
|
63
|
+
errors.push("EventSource type is required");
|
|
64
|
+
}
|
|
65
|
+
if (handler) {
|
|
66
|
+
const handlerErrors = handler.validateConfig(config);
|
|
67
|
+
errors.push(...handlerErrors);
|
|
68
|
+
} else {
|
|
69
|
+
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.TIMER) {
|
|
70
|
+
if (!config.interval || config.interval <= 0) {
|
|
71
|
+
errors.push("Timer interval must be a positive number");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.LARK_CLI && !config.command) {
|
|
75
|
+
errors.push("lark-cli command is required");
|
|
76
|
+
}
|
|
77
|
+
if (config.type === BUILT_IN_EVENT_SOURCE_TYPES.WEBSOCKET && !config.url) {
|
|
78
|
+
errors.push("WebSocket URL is required");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return errors;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { BUILT_IN_EVENT_SOURCE_TYPES, BUILT_IN_EVENT_SOURCE_TYPE_LIST, EventSourceInitHooks, isBuiltInEventSourceType, isValidEventSourceType, getDefaultConfigForType, validateEventSourceConfig };
|
|
@@ -23,6 +23,7 @@ function inferNextNode(messages, definition) {
|
|
|
23
23
|
agentSessionId: metadata.agentSessionId
|
|
24
24
|
};
|
|
25
25
|
case "workflow.node.end":
|
|
26
|
+
case "workflow.node.result":
|
|
26
27
|
return getNextNodes(metadata.workflowNodeId, definition);
|
|
27
28
|
default:
|
|
28
29
|
const lastStart = findLastStartMessage(messages);
|
|
@@ -34,6 +35,15 @@ function inferNextNode(messages, definition) {
|
|
|
34
35
|
agentSessionId: startMetadata.agentSessionId
|
|
35
36
|
};
|
|
36
37
|
}
|
|
38
|
+
const lastCall = findLastCallMessage(messages);
|
|
39
|
+
if (lastCall) {
|
|
40
|
+
const callMetadata = lastCall.metadata;
|
|
41
|
+
return {
|
|
42
|
+
type: "resume_node",
|
|
43
|
+
nodeId: callMetadata.workflowNodeId,
|
|
44
|
+
agentSessionId: callMetadata.agentSessionId
|
|
45
|
+
};
|
|
46
|
+
}
|
|
37
47
|
return { type: "entry_node", nodeId: definition.entryNode };
|
|
38
48
|
}
|
|
39
49
|
}
|
|
@@ -62,14 +72,24 @@ function findLastStartMessage(messages) {
|
|
|
62
72
|
}
|
|
63
73
|
return null;
|
|
64
74
|
}
|
|
75
|
+
function findLastCallMessage(messages) {
|
|
76
|
+
for (let i = messages.length - 1;i >= 0; i--) {
|
|
77
|
+
const msg = messages[i];
|
|
78
|
+
if (msg.metadata?.type === "workflow.node.call") {
|
|
79
|
+
return msg;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
65
84
|
function parseNodeOutputs(messages) {
|
|
66
85
|
const outputs = new Map;
|
|
67
86
|
let lastStartNodeId = null;
|
|
68
87
|
for (const msg of messages) {
|
|
69
88
|
const metadata = msg.metadata;
|
|
70
|
-
|
|
89
|
+
const msgType = metadata?.type;
|
|
90
|
+
if (msgType === "workflow.node.start" || msgType === "workflow.node.call") {
|
|
71
91
|
lastStartNodeId = metadata.workflowNodeId;
|
|
72
|
-
} else if (
|
|
92
|
+
} else if ((msgType === "workflow.node.end" || msgType === "workflow.node.result") && lastStartNodeId) {
|
|
73
93
|
try {
|
|
74
94
|
outputs.set(lastStartNodeId, JSON.parse(msg.content));
|
|
75
95
|
} catch {
|
|
@@ -135,5 +155,6 @@ export {
|
|
|
135
155
|
getAgentSessionIdFromInterrupt,
|
|
136
156
|
findLastStartMessage,
|
|
137
157
|
findLastInterruptMessage,
|
|
158
|
+
findLastCallMessage,
|
|
138
159
|
extractResumeInfo
|
|
139
160
|
};
|
|
@@ -142,7 +142,7 @@ Options:
|
|
|
142
142
|
-s, --session <id> Specify session ID
|
|
143
143
|
--model <model> Use specific model
|
|
144
144
|
-C, --config <path> Config file path
|
|
145
|
-
-q, --quiet
|
|
145
|
+
-q, --no-quiet Enable logging (default: quiet mode is on)
|
|
146
146
|
-r, --reasoning Show AI reasoning process
|
|
147
147
|
--tool-calls Show tool calls
|
|
148
148
|
--tool-results Show tool execution results
|