@ai-setting/roy-agent-core 1.5.61 → 1.5.62
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/agent/index.js +2 -2
- package/dist/env/event-source/index.js +2 -2
- package/dist/env/index.js +8 -8
- package/dist/env/llm/index.js +2 -2
- package/dist/env/task/plugins/index.js +3 -1
- package/dist/env/workflow/engine/index.js +2 -2
- package/dist/env/workflow/index.js +3 -3
- package/dist/env/workflow/utils/index.js +1 -1
- package/dist/index.js +12 -10
- package/dist/shared/@ai-setting/{roy-agent-core-rmd82vf7.js → roy-agent-core-70gt0tp0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hkfkhaas.js → roy-agent-core-bcpp60ww.js} +18 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nd3amf4x.js → roy-agent-core-ecaptews.js} +2 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hg3q4f82.js → roy-agent-core-kap6q69x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-at22pe4k.js → roy-agent-core-v4g5ntf2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-t3367jkk.js → roy-agent-core-v61w8cmf.js} +10 -0
- package/dist/shared/@ai-setting/{roy-agent-core-c4a0rte6.js → roy-agent-core-w4tqc9m1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qqhbxq56.js → roy-agent-core-xp8xrxgc.js} +59 -11
- package/dist/shared/@ai-setting/{roy-agent-core-xztzw1yb.js → roy-agent-core-zv2hwptv.js} +3 -2
- package/package.json +1 -1
package/dist/env/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentComponent,
|
|
3
3
|
AgentComponentConfigSchema
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-kap6q69x.js";
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-ecaptews.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
builtInHandlers,
|
|
5
5
|
getBuiltInHandler,
|
|
6
6
|
larkCliHandler
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
|
|
8
8
|
import {
|
|
9
9
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
10
10
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
validateEventSourceConfig
|
|
16
16
|
} from "../../shared/@ai-setting/roy-agent-core-xb4hvk1m.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
|
|
18
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
import"../../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
package/dist/env/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-v61w8cmf.js";
|
|
4
4
|
import {
|
|
5
5
|
EventSourceComponent,
|
|
6
6
|
builtInHandlers,
|
|
7
7
|
larkCliHandler
|
|
8
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
|
|
9
9
|
import {
|
|
10
10
|
EventSourceInitHooks,
|
|
11
11
|
getDefaultConfigForType,
|
|
@@ -17,17 +17,17 @@ import"../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
|
|
|
17
17
|
import {
|
|
18
18
|
PluginComponent
|
|
19
19
|
} from "../shared/@ai-setting/roy-agent-core-ap59dpve.js";
|
|
20
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
20
|
+
import"../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
|
|
21
21
|
import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
22
22
|
import {
|
|
23
23
|
WorkflowComponent
|
|
24
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
24
|
+
} from "../shared/@ai-setting/roy-agent-core-70gt0tp0.js";
|
|
25
25
|
import"../shared/@ai-setting/roy-agent-core-0jc06hhg.js";
|
|
26
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
26
|
+
import"../shared/@ai-setting/roy-agent-core-v4g5ntf2.js";
|
|
27
27
|
import"../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
|
|
28
28
|
import"../shared/@ai-setting/roy-agent-core-6d5v531t.js";
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
30
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
30
|
+
import"../shared/@ai-setting/roy-agent-core-bcpp60ww.js";
|
|
31
31
|
import"../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
32
32
|
import"../shared/@ai-setting/roy-agent-core-9r8pew8y.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
@@ -38,8 +38,8 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
38
38
|
import {
|
|
39
39
|
AgentComponent,
|
|
40
40
|
AgentComponentConfigSchema
|
|
41
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
42
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
41
|
+
} from "../shared/@ai-setting/roy-agent-core-kap6q69x.js";
|
|
42
|
+
import"../shared/@ai-setting/roy-agent-core-ecaptews.js";
|
|
43
43
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
44
44
|
import {
|
|
45
45
|
TaskComponent
|
package/dist/env/llm/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
ProviderCapabilitiesSchema,
|
|
9
9
|
ProviderConfigSchema,
|
|
10
10
|
ProviderManager
|
|
11
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../../shared/@ai-setting/roy-agent-core-zv2hwptv.js";
|
|
12
12
|
import {
|
|
13
13
|
createInvokeConfig,
|
|
14
14
|
invoke,
|
|
15
15
|
invokeNonStream,
|
|
16
16
|
parseModelString
|
|
17
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../../shared/@ai-setting/roy-agent-core-ecaptews.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
|
|
@@ -3,12 +3,13 @@ import {
|
|
|
3
3
|
NotifyType,
|
|
4
4
|
TaskTagPlugin,
|
|
5
5
|
WORKFLOW_EXTRACTOR_PROMPT,
|
|
6
|
+
createAutoTaskPlugin,
|
|
6
7
|
createLarkCliTaskNotifyHook,
|
|
7
8
|
createWorkflowExtractorAgent,
|
|
8
9
|
formatExtractorInput,
|
|
9
10
|
formatExtractorInputFromDescription,
|
|
10
11
|
parseExtractorOutput
|
|
11
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
} from "../../../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
|
|
12
13
|
import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
13
14
|
import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
|
|
14
15
|
import"../../../shared/@ai-setting/roy-agent-core-qg4rma4c.js";
|
|
@@ -24,6 +25,7 @@ export {
|
|
|
24
25
|
formatExtractorInput,
|
|
25
26
|
createWorkflowExtractorAgent,
|
|
26
27
|
createLarkCliTaskNotifyHook,
|
|
28
|
+
createAutoTaskPlugin,
|
|
27
29
|
WORKFLOW_EXTRACTOR_PROMPT,
|
|
28
30
|
TaskTagPlugin,
|
|
29
31
|
NotifyType,
|
|
@@ -6,11 +6,11 @@ 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-v4g5ntf2.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
|
|
11
11
|
import"../../../shared/@ai-setting/roy-agent-core-6d5v531t.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
13
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../../shared/@ai-setting/roy-agent-core-bcpp60ww.js";
|
|
14
14
|
import"../../../shared/@ai-setting/roy-agent-core-9r8pew8y.js";
|
|
15
15
|
import"../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
16
16
|
import"../../../shared/@ai-setting/roy-agent-core-nhfy3p8q.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkflowComponent
|
|
3
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../../shared/@ai-setting/roy-agent-core-70gt0tp0.js";
|
|
4
4
|
import"../../shared/@ai-setting/roy-agent-core-0jc06hhg.js";
|
|
5
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
5
|
+
import"../../shared/@ai-setting/roy-agent-core-v4g5ntf2.js";
|
|
6
6
|
import"../../shared/@ai-setting/roy-agent-core-zgtmazxg.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-6d5v531t.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
9
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
import"../../shared/@ai-setting/roy-agent-core-bcpp60ww.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-9r8pew8y.js";
|
|
12
12
|
import {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
init_template_resolver,
|
|
4
4
|
resolveTemplateString,
|
|
5
5
|
resolveTemplates
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-bcpp60ww.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
9
9
|
import {
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ModelLimitsSchema,
|
|
12
12
|
ProviderCapabilitiesSchema,
|
|
13
13
|
ProviderConfigSchema
|
|
14
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "./shared/@ai-setting/roy-agent-core-zv2hwptv.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigComponent
|
|
17
17
|
} from "./shared/@ai-setting/roy-agent-core-prdngx28.js";
|
|
@@ -57,13 +57,13 @@ import {
|
|
|
57
57
|
BaseEnvironment,
|
|
58
58
|
generateDescendingId,
|
|
59
59
|
generateId
|
|
60
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
60
|
+
} from "./shared/@ai-setting/roy-agent-core-v61w8cmf.js";
|
|
61
61
|
import {
|
|
62
62
|
EventSourceComponent,
|
|
63
63
|
builtInHandlers,
|
|
64
64
|
getBuiltInHandler,
|
|
65
65
|
larkCliHandler
|
|
66
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
66
|
+
} from "./shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
|
|
67
67
|
import {
|
|
68
68
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
69
69
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -81,23 +81,24 @@ import {
|
|
|
81
81
|
PluginComponent
|
|
82
82
|
} from "./shared/@ai-setting/roy-agent-core-ap59dpve.js";
|
|
83
83
|
import {
|
|
84
|
-
TaskTagPlugin
|
|
85
|
-
|
|
84
|
+
TaskTagPlugin,
|
|
85
|
+
createAutoTaskPlugin
|
|
86
|
+
} from "./shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
|
|
86
87
|
import {
|
|
87
88
|
BasePlugin
|
|
88
89
|
} from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
89
90
|
import {
|
|
90
91
|
WorkflowComponent
|
|
91
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
92
|
+
} from "./shared/@ai-setting/roy-agent-core-70gt0tp0.js";
|
|
92
93
|
import {
|
|
93
94
|
init_node_registry_helper,
|
|
94
95
|
registerDecoratorNodeType
|
|
95
96
|
} from "./shared/@ai-setting/roy-agent-core-0jc06hhg.js";
|
|
96
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
97
|
+
import"./shared/@ai-setting/roy-agent-core-v4g5ntf2.js";
|
|
97
98
|
import"./shared/@ai-setting/roy-agent-core-zgtmazxg.js";
|
|
98
99
|
import"./shared/@ai-setting/roy-agent-core-6d5v531t.js";
|
|
99
100
|
import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
100
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
101
|
+
import"./shared/@ai-setting/roy-agent-core-bcpp60ww.js";
|
|
101
102
|
import"./shared/@ai-setting/roy-agent-core-4t40mkpv.js";
|
|
102
103
|
import"./shared/@ai-setting/roy-agent-core-9r8pew8y.js";
|
|
103
104
|
import"./shared/@ai-setting/roy-agent-core-qnrf2aw6.js";
|
|
@@ -114,13 +115,13 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
|
114
115
|
import {
|
|
115
116
|
AgentComponent,
|
|
116
117
|
AgentComponentConfigSchema
|
|
117
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
118
|
+
} from "./shared/@ai-setting/roy-agent-core-kap6q69x.js";
|
|
118
119
|
import {
|
|
119
120
|
createInvokeConfig,
|
|
120
121
|
invoke,
|
|
121
122
|
invokeNonStream,
|
|
122
123
|
parseModelString
|
|
123
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
124
|
+
} from "./shared/@ai-setting/roy-agent-core-ecaptews.js";
|
|
124
125
|
import {
|
|
125
126
|
AskUserError,
|
|
126
127
|
init_workflow_hil
|
|
@@ -384,6 +385,7 @@ export {
|
|
|
384
385
|
createLogger,
|
|
385
386
|
createInvokeConfig,
|
|
386
387
|
createHook,
|
|
388
|
+
createAutoTaskPlugin,
|
|
387
389
|
closeDatabase,
|
|
388
390
|
builtInHandlers,
|
|
389
391
|
bashTool,
|
|
@@ -148,7 +148,7 @@ var init_template_resolver = __esm(() => {
|
|
|
148
148
|
return value;
|
|
149
149
|
}
|
|
150
150
|
const secondSegment = segments[1];
|
|
151
|
-
if (secondSegment === "result"
|
|
151
|
+
if (secondSegment === "result") {
|
|
152
152
|
if (value && typeof value === "object" && "result" in value) {
|
|
153
153
|
value = value.result;
|
|
154
154
|
if (segments.length === 2) {
|
|
@@ -163,6 +163,23 @@ var init_template_resolver = __esm(() => {
|
|
|
163
163
|
return value;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
if (secondSegment === "output") {
|
|
167
|
+
if (segments.length === 2) {
|
|
168
|
+
if (value && typeof value === "object" && "result" in value) {
|
|
169
|
+
return value.result;
|
|
170
|
+
}
|
|
171
|
+
return value;
|
|
172
|
+
}
|
|
173
|
+
if (value && typeof value === "object" && "result" in value) {
|
|
174
|
+
for (let i = 2;i < segments.length; i++) {
|
|
175
|
+
if (value === null || value === undefined) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
value = value[segments[i]];
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
166
183
|
for (let i = 1;i < segments.length; i++) {
|
|
167
184
|
if (value === null || value === undefined) {
|
|
168
185
|
return;
|
|
@@ -380,7 +380,8 @@ async function invoke(config, options, ctx) {
|
|
|
380
380
|
streamOptions: {
|
|
381
381
|
includeUsage: true
|
|
382
382
|
},
|
|
383
|
-
allowSystemInMessages: true
|
|
383
|
+
allowSystemInMessages: true,
|
|
384
|
+
toolChoice: options.toolChoice ?? "auto"
|
|
384
385
|
};
|
|
385
386
|
const result = await streamText(streamTextOptions);
|
|
386
387
|
let fullContent = "";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAutoTaskPlugin
|
|
3
|
+
} from "./roy-agent-core-xp8xrxgc.js";
|
|
1
4
|
import {
|
|
2
5
|
ContextError,
|
|
3
6
|
ErrorCodes
|
|
@@ -191,6 +194,13 @@ class BaseEnvironment extends BaseComponent {
|
|
|
191
194
|
deniedTools: defaultDeniedTools
|
|
192
195
|
});
|
|
193
196
|
logger.info(`[handle_query] Created default receptionist agent with deniedTools: ${defaultDeniedTools.length} tools denied`);
|
|
197
|
+
try {
|
|
198
|
+
const autoTaskPlugin = createAutoTaskPlugin();
|
|
199
|
+
agentComponent.registerPlugin("default", autoTaskPlugin);
|
|
200
|
+
logger.info("[handle_query] AutoTaskPlugin registered on default agent");
|
|
201
|
+
} catch (err) {
|
|
202
|
+
logger.warn(`[handle_query] Failed to register AutoTaskPlugin: ${err}`);
|
|
203
|
+
}
|
|
194
204
|
} else {
|
|
195
205
|
if (agent.config?.systemPrompt) {
|
|
196
206
|
if (agent.config.systemPrompt.includes("{{memory}}")) {
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
} from "./roy-agent-core-y5d04fm3.js";
|
|
13
13
|
import {
|
|
14
14
|
TracedAs,
|
|
15
|
-
init_decorator
|
|
15
|
+
init_decorator,
|
|
16
|
+
wrapFunction
|
|
16
17
|
} from "./roy-agent-core-k05v31rc.js";
|
|
17
18
|
import {
|
|
18
19
|
createLogger,
|
|
@@ -387,12 +388,59 @@ ${prompt}`;
|
|
|
387
388
|
__require("fs").mkdirSync(dataDir, { recursive: true });
|
|
388
389
|
}
|
|
389
390
|
}
|
|
391
|
+
// src/env/task/plugins/auto-task-plugin.ts
|
|
392
|
+
init_logger();
|
|
393
|
+
init_decorator();
|
|
394
|
+
var logger2 = createLogger("AutoTaskPlugin");
|
|
395
|
+
function createAutoTaskPlugin(config) {
|
|
396
|
+
const threshold = config?.threshold ?? 10;
|
|
397
|
+
const agentName = config?.agentName ?? "default";
|
|
398
|
+
const triggeredSessions = new Set;
|
|
399
|
+
async function executeImpl(ctx) {
|
|
400
|
+
try {
|
|
401
|
+
if (ctx.agent.name !== agentName)
|
|
402
|
+
return { continue: true };
|
|
403
|
+
if (ctx.iteration !== threshold)
|
|
404
|
+
return { continue: true };
|
|
405
|
+
const sid = ctx.context?.sessionId ?? "unknown";
|
|
406
|
+
if (triggeredSessions.has(sid))
|
|
407
|
+
return { continue: true };
|
|
408
|
+
triggeredSessions.add(sid);
|
|
409
|
+
const tr = ctx.toolResult;
|
|
410
|
+
if (tr && tr.result && tr.result.output !== undefined) {
|
|
411
|
+
tr.result.output = (tr.result.output || "") + `
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
\uD83D\uDCCC **System: This session has reached ` + ctx.iteration + " ReAct iterations. " + "The current work may be long-running. Please use `delegate_task` to assign " + "it to a sub-agent (e.g. `roy`) that will create a proper task and continue.**\n" + 'Example: `delegate_task(description="<summary>", prompt="Continue working on the current task...", subagent_type="roy")`\n---';
|
|
415
|
+
}
|
|
416
|
+
logger2.info(`[AutoTaskPlugin] Prompted delegate_task at iteration ${ctx.iteration} (session=${sid.slice(0, 12)}...)`);
|
|
417
|
+
return { continue: true };
|
|
418
|
+
} catch (err) {
|
|
419
|
+
logger2.error(`[AutoTaskPlugin] hook failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
420
|
+
return { continue: true };
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const execute = wrapFunction(executeImpl, "plugin.auto-task.tool-call-hook", {
|
|
424
|
+
recordParams: false,
|
|
425
|
+
recordResult: true,
|
|
426
|
+
log: true
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
name: "AutoTaskPlugin",
|
|
430
|
+
version: "1.0.0",
|
|
431
|
+
description: "ReAct iteration 达到阈值时提示 agent 用 delegate_task 将工作转为 task",
|
|
432
|
+
hooks: [
|
|
433
|
+
{ point: "agent:after.tool", priority: 50 }
|
|
434
|
+
],
|
|
435
|
+
execute
|
|
436
|
+
};
|
|
437
|
+
}
|
|
390
438
|
// src/env/task/plugins/lark-cli-task-notify-plugin.ts
|
|
391
439
|
init_decorator();
|
|
392
440
|
init_logger();
|
|
393
441
|
init_context();
|
|
394
442
|
import { spawn } from "child_process";
|
|
395
|
-
var
|
|
443
|
+
var logger3 = createLogger("lark-cli:task-notify");
|
|
396
444
|
function isTaskNotifyDebugEnabled() {
|
|
397
445
|
return process.env.ROY_TASK_NOTIFY_DEBUG === "1" || process.env.ROY_TRACE_DEBUG === "1";
|
|
398
446
|
}
|
|
@@ -439,7 +487,7 @@ class LarkCliTaskNotifyHook {
|
|
|
439
487
|
if (this.pluginName && this.sourceId) {
|
|
440
488
|
const key = `${this.sourceId}:${this.pluginName}`;
|
|
441
489
|
if (env.pluginEnabled && env.pluginEnabled[key] !== true) {
|
|
442
|
-
|
|
490
|
+
logger3.debug(`Plugin not enabled for source: ${key}`);
|
|
443
491
|
return;
|
|
444
492
|
}
|
|
445
493
|
}
|
|
@@ -501,7 +549,7 @@ class LarkCliTaskNotifyHook {
|
|
|
501
549
|
async onAfterOperationCreate(ctx) {
|
|
502
550
|
const { operation } = ctx.data;
|
|
503
551
|
if (!operation) {
|
|
504
|
-
|
|
552
|
+
logger3.debug("onAfterOperationCreate: operation is missing, skip");
|
|
505
553
|
return;
|
|
506
554
|
}
|
|
507
555
|
if (!this.shouldNotify("operation_created" /* OPERATION_CREATED */)) {
|
|
@@ -531,7 +579,7 @@ class LarkCliTaskNotifyHook {
|
|
|
531
579
|
const chatId = replyChannel?.chatId;
|
|
532
580
|
const messageId = replyChannel?.messageId;
|
|
533
581
|
if (!chatId && !messageId) {
|
|
534
|
-
|
|
582
|
+
logger3.debug(`No replyChannel available for ${type}`);
|
|
535
583
|
return;
|
|
536
584
|
}
|
|
537
585
|
const message = `${title}
|
|
@@ -539,16 +587,16 @@ class LarkCliTaskNotifyHook {
|
|
|
539
587
|
${content}`;
|
|
540
588
|
try {
|
|
541
589
|
if (isTaskNotifyDebugEnabled()) {
|
|
542
|
-
|
|
590
|
+
logger3.debug(`Sending message - messageId: ${messageId}`);
|
|
543
591
|
}
|
|
544
592
|
await this.sendLarkMessage({
|
|
545
593
|
chatId,
|
|
546
594
|
messageId,
|
|
547
595
|
content: message
|
|
548
596
|
});
|
|
549
|
-
|
|
597
|
+
logger3.info(`Notification sent: ${type}`);
|
|
550
598
|
} catch (error) {
|
|
551
|
-
|
|
599
|
+
logger3.error(`Failed to send notification: ${error}`);
|
|
552
600
|
}
|
|
553
601
|
}
|
|
554
602
|
sendLarkMessage(options) {
|
|
@@ -590,7 +638,7 @@ ${content}`;
|
|
|
590
638
|
});
|
|
591
639
|
proc.on("close", (code) => {
|
|
592
640
|
if (code === 0) {
|
|
593
|
-
|
|
641
|
+
logger3.debug(`lark-cli output: ${stdout}`);
|
|
594
642
|
resolve();
|
|
595
643
|
} else {
|
|
596
644
|
reject(new Error(`lark-cli exited with code ${code}: ${stderr}`));
|
|
@@ -674,7 +722,7 @@ ${content}`;
|
|
|
674
722
|
const now = Date.now();
|
|
675
723
|
const lastTime = this.lastNotifyTimestamps.get(key);
|
|
676
724
|
if (lastTime && now - lastTime < throttleMs) {
|
|
677
|
-
|
|
725
|
+
logger3.debug(`[throttle] Skipping OPERATION_CREATED notify for task #${operation.taskId}, last notified ${now - lastTime}ms ago`);
|
|
678
726
|
return true;
|
|
679
727
|
}
|
|
680
728
|
this.lastNotifyTimestamps.set(key, now);
|
|
@@ -715,4 +763,4 @@ __legacyDecorateClassTS([
|
|
|
715
763
|
function createLarkCliTaskNotifyHook(config = {}) {
|
|
716
764
|
return new LarkCliTaskNotifyHook(config);
|
|
717
765
|
}
|
|
718
|
-
export { WORKFLOW_EXTRACTOR_PROMPT, createWorkflowExtractorAgent, formatExtractorInput, formatExtractorInputFromDescription, parseExtractorOutput, TaskTagPlugin, NotifyType, LarkCliTaskNotifyHook, createLarkCliTaskNotifyHook };
|
|
766
|
+
export { createAutoTaskPlugin, WORKFLOW_EXTRACTOR_PROMPT, createWorkflowExtractorAgent, formatExtractorInput, formatExtractorInputFromDescription, parseExtractorOutput, TaskTagPlugin, NotifyType, LarkCliTaskNotifyHook, createLarkCliTaskNotifyHook };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
invoke
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ecaptews.js";
|
|
4
4
|
import {
|
|
5
5
|
ContextError,
|
|
6
6
|
ErrorCodes
|
|
@@ -678,7 +678,8 @@ class LLMComponent extends BaseComponent {
|
|
|
678
678
|
context: {
|
|
679
679
|
sessionId: request.context?.sessionId,
|
|
680
680
|
messageId: request.context?.messageId
|
|
681
|
-
}
|
|
681
|
+
},
|
|
682
|
+
toolChoice: request.toolChoice
|
|
682
683
|
}, { abort: ctx.abortSignal });
|
|
683
684
|
if (result.isError) {
|
|
684
685
|
throw new Error(result.result);
|