@ai-setting/roy-agent-core 1.6.14 → 1.6.16
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/config/index.js +10 -10
- package/dist/env/agent/index.js +16 -16
- package/dist/env/commands/index.js +10 -10
- package/dist/env/context/index.js +27 -7
- package/dist/env/debug/index.js +10 -10
- package/dist/env/event-source/index.js +17 -15
- package/dist/env/hook/index.js +8 -8
- package/dist/env/index.js +41 -41
- package/dist/env/llm/index.js +12 -12
- package/dist/env/log-trace/index.js +10 -10
- package/dist/env/mcp/index.js +11 -11
- package/dist/env/mcp/tool/index.js +4 -4
- package/dist/env/memory/index.js +11 -11
- package/dist/env/memory/plugin/index.js +4 -4
- package/dist/env/plugin/index.js +10 -10
- package/dist/env/prompt/index.js +11 -11
- package/dist/env/session/index.js +13 -13
- package/dist/env/session/storage/index.js +6 -6
- package/dist/env/skill/index.js +10 -10
- package/dist/env/task/delegate/index.js +11 -11
- package/dist/env/task/index.js +16 -16
- package/dist/env/task/plugins/index.js +10 -10
- package/dist/env/task/storage/index.js +5 -5
- package/dist/env/task/tools/index.js +6 -6
- package/dist/env/tool/built-in/index.js +6 -6
- package/dist/env/tool/index.js +13 -13
- package/dist/env/workflow/engine/index.js +12 -12
- package/dist/env/workflow/index.js +23 -23
- package/dist/env/workflow/nodes/index.js +5 -5
- package/dist/env/workflow/service/index.js +5 -5
- package/dist/env/workflow/storage/index.js +6 -6
- package/dist/env/workflow/tools/index.js +17 -17
- package/dist/env/workflow/utils/index.js +7 -7
- package/dist/index.js +54 -52
- package/dist/shared/@ai-setting/{roy-agent-core-r74v00c7.js → roy-agent-core-02aw62bv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-80e4a3g5.js → roy-agent-core-1mrc9a1r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xxgazz27.js → roy-agent-core-1qjgwjjs.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-fwxqevpf.js → roy-agent-core-25ngkkpb.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-rga3f0hm.js → roy-agent-core-2b0mw2h3.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-ck0m8754.js → roy-agent-core-416rpxkp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-c6592r3c.js → roy-agent-core-4an1p9a1.js} +31 -2
- package/dist/shared/@ai-setting/{roy-agent-core-r53regz9.js → roy-agent-core-4z7dzcgb.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-txsswwhm.js → roy-agent-core-5pzegp1x.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-htjag2nr.js → roy-agent-core-77wfej1h.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-resnbd2j.js → roy-agent-core-7kw06e4b.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yfhgxh5a.js → roy-agent-core-7r72622v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dcd1s7ct.js → roy-agent-core-8n0e62y4.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-wpw37qqf.js → roy-agent-core-8v0hzw96.js} +30 -9
- package/dist/shared/@ai-setting/{roy-agent-core-fdm579b1.js → roy-agent-core-96mj6gvc.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-1mq9erp8.js → roy-agent-core-ajp566yv.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-j62bjagf.js → roy-agent-core-akb8mb9v.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5h49ct1a.js → roy-agent-core-ataagh3a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-606z25nw.js → roy-agent-core-atpchjdz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9nhwdq9r.js → roy-agent-core-b8wn8yhk.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-mmb9484f.js → roy-agent-core-bq1gskrf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nw39k111.js → roy-agent-core-bqe4c9f2.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-px8ghk4g.js → roy-agent-core-bsxgrqzq.js} +28 -13
- package/dist/shared/@ai-setting/{roy-agent-core-6qbyfzsw.js → roy-agent-core-cfqm5w9b.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-1gsnq4p2.js → roy-agent-core-dh9rajdh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-st9y9z07.js → roy-agent-core-dnns0v64.js} +6 -6
- package/dist/shared/@ai-setting/roy-agent-core-dtkbj8fk.js +206 -0
- package/dist/shared/@ai-setting/{roy-agent-core-8x4ngxcy.js → roy-agent-core-e0kaxcy1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nv4yfy3m.js → roy-agent-core-eaj0b1hm.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-3kbf53sh.js → roy-agent-core-ehpnd2be.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-psfkwe4g.js → roy-agent-core-ez91vxas.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jw0hbacv.js → roy-agent-core-fxembepv.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-80bdhnwk.js → roy-agent-core-gc75v3px.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-24rmf17n.js → roy-agent-core-gmnex23m.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-atjd1tpt.js → roy-agent-core-keb51jag.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-7z9b1fm8.js → roy-agent-core-m00kamqp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4w6rgxs4.js → roy-agent-core-mdp8y7ky.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vyygk314.js → roy-agent-core-nna4s0qs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-f79ee0aw.js → roy-agent-core-p4z6nxgz.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-apz6v22z.js → roy-agent-core-pq1q854s.js} +247 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qbm5zy6s.js → roy-agent-core-pr4jekyy.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-rpq0mcvv.js → roy-agent-core-r0t34bbh.js} +79 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ywtmc0bh.js → roy-agent-core-r15sn7ve.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9hqqhye6.js → roy-agent-core-sqt96sam.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-v5nknfh0.js → roy-agent-core-tycbpm17.js} +40 -2
- package/dist/shared/@ai-setting/{roy-agent-core-2yavqjsh.js → roy-agent-core-v20nxrs1.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-dbkkjmqz.js → roy-agent-core-vc7p80sd.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-x7fgze6s.js → roy-agent-core-vkesx61c.js} +4 -4
- package/dist/shared/@ai-setting/roy-agent-core-w6kj6nmj.js +11 -0
- package/dist/shared/@ai-setting/{roy-agent-core-wtbyj0q1.js → roy-agent-core-wr3pk3h3.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-wsqnf2za.js +19 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ra4y7e4p.js → roy-agent-core-x36fsm47.js} +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-w6wagmhw.js → roy-agent-core-xzc53mnk.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fvkyv5j6.js → roy-agent-core-ymz9dgw0.js} +14 -12
- package/dist/shared/@ai-setting/{roy-agent-core-m0cnmg7b.js → roy-agent-core-yqxrekhg.js} +82 -14
- package/dist/shared/@ai-setting/{roy-agent-core-nhncpbzz.js → roy-agent-core-yr3fp8tv.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-m0wp34r4.js → roy-agent-core-z1hm09xp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9abv4ewh.js → roy-agent-core-zdzkzx5g.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-95bbd2jv.js → roy-agent-core-zs4f0tcy.js} +2 -2
- package/dist/utils/temp-file-manager/index.js +4 -4
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-6jqpdjr4.js +0 -19
- package/dist/shared/@ai-setting/roy-agent-core-endah27g.js +0 -81
- package/dist/shared/@ai-setting/roy-agent-core-qfdj8872.js +0 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
safeParseToolArgs
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-e0kaxcy1.js";
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
init_logger
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
8
8
|
import {
|
|
9
9
|
__require
|
|
10
10
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProcessRegistry,
|
|
3
3
|
runWithProcessRegistryAsync
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-eaj0b1hm.js";
|
|
5
5
|
import {
|
|
6
6
|
builtInPrompts
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-pq1q854s.js";
|
|
8
8
|
import {
|
|
9
9
|
runWithBgTaskIdAsync
|
|
10
10
|
} from "./roy-agent-core-c1v263jn.js";
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_SUBAGENT_PROMPT
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-tycbpm17.js";
|
|
14
14
|
import {
|
|
15
15
|
TaskHookPoints
|
|
16
16
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
17
17
|
import {
|
|
18
18
|
globalHookManager,
|
|
19
19
|
init_global_hook_manager
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
21
21
|
import {
|
|
22
22
|
init_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-sqt96sam.js";
|
|
24
24
|
import {
|
|
25
|
-
getCurrentTaskId
|
|
26
|
-
|
|
25
|
+
getCurrentTaskId,
|
|
26
|
+
getEnvContext
|
|
27
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
27
28
|
import {
|
|
28
29
|
TracedAs,
|
|
29
30
|
init_decorator,
|
|
30
31
|
wrapFunction
|
|
31
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
32
33
|
import {
|
|
33
34
|
createLogger,
|
|
34
35
|
init_logger
|
|
35
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
36
37
|
import {
|
|
37
38
|
__legacyDecorateClassTS
|
|
38
39
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -419,6 +420,26 @@ class BackgroundTaskManager {
|
|
|
419
420
|
created_by: "subagent",
|
|
420
421
|
task_description: description
|
|
421
422
|
};
|
|
423
|
+
const parentEnvContext = getEnvContext();
|
|
424
|
+
if (parentEnvContext) {
|
|
425
|
+
if (parentEnvContext.messageId) {
|
|
426
|
+
metadata.messageId = parentEnvContext.messageId;
|
|
427
|
+
}
|
|
428
|
+
const replyChannel = parentEnvContext.replyChannel;
|
|
429
|
+
if (replyChannel?.messageId) {
|
|
430
|
+
metadata.larkMessageId = replyChannel.messageId;
|
|
431
|
+
}
|
|
432
|
+
if (replyChannel?.chatId) {
|
|
433
|
+
metadata.chatId = replyChannel.chatId;
|
|
434
|
+
}
|
|
435
|
+
if (replyChannel?.userId) {
|
|
436
|
+
metadata.larkUserId = replyChannel.userId;
|
|
437
|
+
}
|
|
438
|
+
const profile = replyChannel?.profile;
|
|
439
|
+
if (profile) {
|
|
440
|
+
metadata.larkProfile = profile;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
422
443
|
subSession = await sessionComponent.create({
|
|
423
444
|
title: `${description} (@${subagentType} subagent)`,
|
|
424
445
|
parentSessionId,
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
getMaxOutput,
|
|
4
4
|
init_logger,
|
|
5
5
|
simplifyFilePath
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
7
7
|
import {
|
|
8
8
|
getTracerProvider,
|
|
9
9
|
init_tracer_provider
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-m00kamqp.js";
|
|
11
11
|
import {
|
|
12
12
|
__esm
|
|
13
13
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TagRepository
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-atpchjdz.js";
|
|
4
4
|
import {
|
|
5
5
|
exports_search_query_parser,
|
|
6
6
|
init_search_query_parser
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
12
12
|
import {
|
|
13
13
|
__require,
|
|
14
14
|
__toCommonJS
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-02aw62bv.js";
|
|
4
4
|
import {
|
|
5
5
|
HookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
7
7
|
|
|
8
8
|
// src/env/component.ts
|
|
9
9
|
class BaseComponent {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TempFileManager
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ataagh3a.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
@@ -11,24 +11,24 @@ import {
|
|
|
11
11
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseComponent
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
15
15
|
import {
|
|
16
16
|
ToolHookPoints,
|
|
17
17
|
globalHookManager,
|
|
18
18
|
init_global_hook_manager
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
20
20
|
import {
|
|
21
21
|
getCurrentTaskId,
|
|
22
22
|
init_env_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
24
24
|
import {
|
|
25
25
|
TracedAs,
|
|
26
26
|
init_decorator
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
28
28
|
import {
|
|
29
29
|
createLogger,
|
|
30
30
|
init_logger
|
|
31
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
32
32
|
import {
|
|
33
33
|
__legacyDecorateClassTS,
|
|
34
34
|
__require
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
MemorySessionStore,
|
|
8
8
|
SQLiteSessionStore
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-zs4f0tcy.js";
|
|
10
10
|
import {
|
|
11
11
|
envKeyToConfigKey
|
|
12
12
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
16
16
|
import {
|
|
17
17
|
TracedAs,
|
|
18
18
|
init_decorator
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
20
20
|
import {
|
|
21
21
|
createLogger,
|
|
22
22
|
init_logger
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
24
24
|
import {
|
|
25
25
|
__legacyDecorateClassTS
|
|
26
26
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TaskTagPlugin,
|
|
3
3
|
createLarkCliTaskNotifyHook
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-yqxrekhg.js";
|
|
5
5
|
import {
|
|
6
6
|
envKeyToConfigKey
|
|
7
7
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseComponent
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
11
11
|
import {
|
|
12
12
|
globalHookManager,
|
|
13
13
|
init_global_hook_manager
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
15
15
|
import {
|
|
16
16
|
init_context
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-sqt96sam.js";
|
|
18
18
|
import {
|
|
19
19
|
createEnvContext,
|
|
20
20
|
runWithEnvContext
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
22
22
|
import {
|
|
23
23
|
TracedAs,
|
|
24
24
|
init_decorator
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
26
26
|
import {
|
|
27
27
|
createLogger,
|
|
28
28
|
init_logger
|
|
29
|
-
} from "./roy-agent-core-
|
|
29
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
30
30
|
import {
|
|
31
31
|
getTracerProvider
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-m00kamqp.js";
|
|
33
33
|
import {
|
|
34
34
|
__legacyDecorateClassTS,
|
|
35
35
|
__require
|
|
@@ -1021,10 +1021,25 @@ class LarkCliInstance {
|
|
|
1021
1021
|
};
|
|
1022
1022
|
const userId = this.extractUserId(rawEvent);
|
|
1023
1023
|
const envReplyChannel = this.buildReplyChannel(replyChannel);
|
|
1024
|
+
const larkMessageId = replyChannel?.messageId ?? metadata?.messageId;
|
|
1024
1025
|
const envContext = createEnvContext({
|
|
1025
1026
|
envEvent: evt,
|
|
1026
1027
|
sourceId: this.config.id,
|
|
1027
1028
|
userId,
|
|
1029
|
+
messageId: larkMessageId,
|
|
1030
|
+
event: larkMessageId ? {
|
|
1031
|
+
source: "lark",
|
|
1032
|
+
id: larkMessageId,
|
|
1033
|
+
receivedAt: new Date(timestamp).toISOString(),
|
|
1034
|
+
payload: rawEvent,
|
|
1035
|
+
metadata: {
|
|
1036
|
+
chatId: metadata?.chatId,
|
|
1037
|
+
userId,
|
|
1038
|
+
chatType: metadata?.chatType,
|
|
1039
|
+
profile: replyChannel?.profile,
|
|
1040
|
+
appId: metadata?.appId
|
|
1041
|
+
}
|
|
1042
|
+
} : undefined,
|
|
1028
1043
|
replyChannel: envReplyChannel,
|
|
1029
1044
|
pluginEnabled,
|
|
1030
1045
|
plugins
|
|
@@ -1103,13 +1118,13 @@ class LarkCliInstance {
|
|
|
1103
1118
|
return new Promise((resolve, reject) => {
|
|
1104
1119
|
const { chatId, userId, messageId, content, as: identity, format = "text", profile } = options;
|
|
1105
1120
|
const contentFlag = format === "markdown" ? "--markdown" : "--text";
|
|
1106
|
-
const args = ["im"
|
|
1121
|
+
const args = ["im"];
|
|
1107
1122
|
if (messageId) {
|
|
1108
|
-
args.push("+messages-reply", "--message-id", messageId, contentFlag, content);
|
|
1123
|
+
args.push("+messages-reply", "--message-id", messageId, "--as", identity, contentFlag, content);
|
|
1109
1124
|
} else if (chatId) {
|
|
1110
|
-
args.push("--chat-id", chatId, contentFlag, content);
|
|
1125
|
+
args.push("+messages-send", "--chat-id", chatId, "--as", identity, contentFlag, content);
|
|
1111
1126
|
} else if (userId) {
|
|
1112
|
-
args.push("--user-id", userId, contentFlag, content);
|
|
1127
|
+
args.push("+messages-send", "--user-id", userId, "--as", identity, contentFlag, content);
|
|
1113
1128
|
} else {
|
|
1114
1129
|
reject(new Error("No target specified for sending message"));
|
|
1115
1130
|
return;
|
|
@@ -1609,4 +1624,4 @@ __legacyDecorateClassTS([
|
|
|
1609
1624
|
TracedAs("event-source.update", { recordParams: false, log: false })
|
|
1610
1625
|
], EventSourceComponent.prototype, "update", null);
|
|
1611
1626
|
|
|
1612
|
-
export { TimerInstance, timerHandler, buildDefaultBountyIMSystemPrompt, resolveBountyIMSystemPrompt, BountyIMInstance, bountyIMHandler, larkCliHandler, builtInHandlers, getBuiltInHandler, EventSourceComponent };
|
|
1627
|
+
export { TimerInstance, timerHandler, buildDefaultBountyIMSystemPrompt, resolveBountyIMSystemPrompt, BountyIMInstance, bountyIMHandler, extractMetadata, larkCliHandler, builtInHandlers, getBuiltInHandler, EventSourceComponent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
builtInPrompts
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-pq1q854s.js";
|
|
4
4
|
import {
|
|
5
5
|
getXDGPath
|
|
6
6
|
} from "./roy-agent-core-qxnbvgwe.js";
|
|
@@ -10,18 +10,18 @@ import {
|
|
|
10
10
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
11
11
|
import {
|
|
12
12
|
BaseComponent
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
14
14
|
import {
|
|
15
15
|
createHook
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-02aw62bv.js";
|
|
17
17
|
import {
|
|
18
18
|
globalHookManager,
|
|
19
19
|
init_global_hook_manager
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-vc7p80sd.js";
|
|
21
21
|
import {
|
|
22
22
|
createLogger,
|
|
23
23
|
init_logger
|
|
24
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
25
25
|
|
|
26
26
|
// src/env/prompt/types.ts
|
|
27
27
|
import { z } from "zod";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAutoTaskPlugin
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-yqxrekhg.js";
|
|
4
4
|
import {
|
|
5
5
|
ContextError,
|
|
6
6
|
ErrorCodes
|
|
7
7
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseComponent
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
11
11
|
import {
|
|
12
12
|
init_context
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-sqt96sam.js";
|
|
14
14
|
import {
|
|
15
15
|
getEnvContext,
|
|
16
16
|
init_env_context,
|
|
17
17
|
runWithEnvContextAsync
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-dtkbj8fk.js";
|
|
19
19
|
import {
|
|
20
20
|
TracedAs,
|
|
21
21
|
init_decorator
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
23
23
|
import {
|
|
24
24
|
createLogger,
|
|
25
25
|
init_logger
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
27
27
|
import {
|
|
28
28
|
__legacyDecorateClassTS
|
|
29
29
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_decorator,
|
|
3
|
+
wrapFunction
|
|
4
|
+
} from "./roy-agent-core-96mj6gvc.js";
|
|
5
|
+
import {
|
|
6
|
+
createLogger,
|
|
7
|
+
init_logger
|
|
8
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
9
|
+
import {
|
|
10
|
+
__esm
|
|
11
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
12
|
+
|
|
13
|
+
// src/env/context/env-event.ts
|
|
14
|
+
function isLarkEvent(event) {
|
|
15
|
+
return event?.source === "lark";
|
|
16
|
+
}
|
|
17
|
+
function isGithubEvent(event) {
|
|
18
|
+
return event?.source === "github";
|
|
19
|
+
}
|
|
20
|
+
function isJiraEvent(event) {
|
|
21
|
+
return event?.source === "jira";
|
|
22
|
+
}
|
|
23
|
+
function getLarkMessageId(event) {
|
|
24
|
+
if (!isLarkEvent(event))
|
|
25
|
+
return;
|
|
26
|
+
if (event.id)
|
|
27
|
+
return event.id;
|
|
28
|
+
const payload = event.payload;
|
|
29
|
+
return payload?.message?.message_id ?? payload?.message_id;
|
|
30
|
+
}
|
|
31
|
+
function getLarkChatId(event) {
|
|
32
|
+
if (!isLarkEvent(event))
|
|
33
|
+
return;
|
|
34
|
+
const payload = event.payload;
|
|
35
|
+
return payload?.chat_id ?? payload?.message?.chat_id;
|
|
36
|
+
}
|
|
37
|
+
function getLarkUserId(event) {
|
|
38
|
+
if (!isLarkEvent(event))
|
|
39
|
+
return;
|
|
40
|
+
const payload = event.payload;
|
|
41
|
+
const senderId = payload?.event?.sender?.sender_id ?? payload?.sender?.sender_id ?? undefined;
|
|
42
|
+
return senderId?.open_id ?? senderId?.user_id;
|
|
43
|
+
}
|
|
44
|
+
function serializeEventToEnv(event) {
|
|
45
|
+
if (!event)
|
|
46
|
+
return {};
|
|
47
|
+
const env = {
|
|
48
|
+
[`${EVENT_ENV_PREFIX}SOURCE`]: event.source,
|
|
49
|
+
[`${EVENT_ENV_PREFIX}ID`]: event.id,
|
|
50
|
+
[`${EVENT_ENV_PREFIX}RECEIVED_AT`]: event.receivedAt
|
|
51
|
+
};
|
|
52
|
+
if (event.payload !== undefined) {
|
|
53
|
+
env[`${EVENT_ENV_PREFIX}PAYLOAD`] = JSON.stringify(event.payload);
|
|
54
|
+
}
|
|
55
|
+
if (event.metadata !== undefined) {
|
|
56
|
+
env[`${EVENT_ENV_PREFIX}METADATA`] = JSON.stringify(event.metadata);
|
|
57
|
+
}
|
|
58
|
+
return env;
|
|
59
|
+
}
|
|
60
|
+
function restoreEventFromEnv(env = process.env) {
|
|
61
|
+
const source = env[`${EVENT_ENV_PREFIX}SOURCE`];
|
|
62
|
+
const id = env[`${EVENT_ENV_PREFIX}ID`];
|
|
63
|
+
if (!source || !id)
|
|
64
|
+
return;
|
|
65
|
+
const payloadStr = env[`${EVENT_ENV_PREFIX}PAYLOAD`];
|
|
66
|
+
const metadataStr = env[`${EVENT_ENV_PREFIX}METADATA`];
|
|
67
|
+
let payload;
|
|
68
|
+
let metadata;
|
|
69
|
+
try {
|
|
70
|
+
if (payloadStr)
|
|
71
|
+
payload = JSON.parse(payloadStr);
|
|
72
|
+
} catch {}
|
|
73
|
+
try {
|
|
74
|
+
if (metadataStr)
|
|
75
|
+
metadata = JSON.parse(metadataStr);
|
|
76
|
+
} catch {}
|
|
77
|
+
return {
|
|
78
|
+
source,
|
|
79
|
+
id,
|
|
80
|
+
receivedAt: env[`${EVENT_ENV_PREFIX}RECEIVED_AT`] ?? new Date().toISOString(),
|
|
81
|
+
payload,
|
|
82
|
+
metadata
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
var EVENT_ENV_PREFIX = "ROY_EVENT_";
|
|
86
|
+
var init_env_event = () => {};
|
|
87
|
+
|
|
88
|
+
// src/env/context/env-context.ts
|
|
89
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
90
|
+
function getEnvContext() {
|
|
91
|
+
return envContextStorage.getStore();
|
|
92
|
+
}
|
|
93
|
+
function getEnvContextOrEmpty() {
|
|
94
|
+
return envContextStorage.getStore() || {};
|
|
95
|
+
}
|
|
96
|
+
function hasEnvContext() {
|
|
97
|
+
return envContextStorage.getStore() !== undefined;
|
|
98
|
+
}
|
|
99
|
+
function getCurrentTaskId() {
|
|
100
|
+
return envContextStorage.getStore()?.agentContext?.currentTaskId;
|
|
101
|
+
}
|
|
102
|
+
function runWithEnvContext(context, fn) {
|
|
103
|
+
if (context) {
|
|
104
|
+
return envContextStorage.run(context, fn);
|
|
105
|
+
}
|
|
106
|
+
return fn();
|
|
107
|
+
}
|
|
108
|
+
async function runWithEnvContextAsync(context, fn) {
|
|
109
|
+
if (context) {
|
|
110
|
+
return envContextStorage.run(context, fn);
|
|
111
|
+
}
|
|
112
|
+
return fn();
|
|
113
|
+
}
|
|
114
|
+
function createEnvContext(options) {
|
|
115
|
+
let replyChannel = options.replyChannel;
|
|
116
|
+
if (replyChannel && options.messageId && !replyChannel.messageId) {
|
|
117
|
+
replyChannel = { ...replyChannel, messageId: options.messageId };
|
|
118
|
+
}
|
|
119
|
+
let event = options.event;
|
|
120
|
+
if (!event && options.messageId) {
|
|
121
|
+
event = {
|
|
122
|
+
source: "lark",
|
|
123
|
+
id: options.messageId,
|
|
124
|
+
receivedAt: new Date().toISOString(),
|
|
125
|
+
payload: undefined,
|
|
126
|
+
metadata: {
|
|
127
|
+
chatId: replyChannel?.chatId,
|
|
128
|
+
userId: replyChannel?.userId,
|
|
129
|
+
profile: replyChannel?.profile
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
envEvent: options.envEvent,
|
|
135
|
+
sourceId: options.sourceId,
|
|
136
|
+
userId: options.userId,
|
|
137
|
+
messageId: options.messageId ?? (event?.source === "lark" ? event.id : undefined) ?? replyChannel?.messageId,
|
|
138
|
+
event,
|
|
139
|
+
traceId: options.traceId ?? crypto.randomUUID(),
|
|
140
|
+
requestId: options.requestId ?? crypto.randomUUID(),
|
|
141
|
+
replyChannel,
|
|
142
|
+
pluginEnabled: options.pluginEnabled,
|
|
143
|
+
plugins: options.plugins,
|
|
144
|
+
timestamp: options.timestamp ?? Date.now()
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function mergeEnvContext(partial) {
|
|
148
|
+
const current = envContextStorage.getStore();
|
|
149
|
+
if (current) {
|
|
150
|
+
if (partial.agentContext && current.agentContext) {
|
|
151
|
+
Object.assign(current.agentContext, partial.agentContext);
|
|
152
|
+
delete partial.agentContext;
|
|
153
|
+
}
|
|
154
|
+
Object.assign(current, partial);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function getEventFromEnvContext(ctx) {
|
|
158
|
+
if (!ctx)
|
|
159
|
+
return;
|
|
160
|
+
if (ctx.event)
|
|
161
|
+
return ctx.event;
|
|
162
|
+
const replyMessageId = ctx.replyChannel?.messageId;
|
|
163
|
+
if (replyMessageId) {
|
|
164
|
+
return {
|
|
165
|
+
source: "lark",
|
|
166
|
+
id: replyMessageId,
|
|
167
|
+
receivedAt: new Date().toISOString(),
|
|
168
|
+
payload: undefined,
|
|
169
|
+
metadata: {
|
|
170
|
+
chatId: ctx.replyChannel?.chatId,
|
|
171
|
+
userId: ctx.replyChannel?.userId,
|
|
172
|
+
profile: ctx.replyChannel?.profile
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (ctx.messageId) {
|
|
177
|
+
return {
|
|
178
|
+
source: "lark",
|
|
179
|
+
id: ctx.messageId,
|
|
180
|
+
receivedAt: new Date().toISOString(),
|
|
181
|
+
payload: undefined
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
var logger, envContextStorage, setCurrentTaskId;
|
|
187
|
+
var init_env_context = __esm(() => {
|
|
188
|
+
init_logger();
|
|
189
|
+
init_decorator();
|
|
190
|
+
init_env_event();
|
|
191
|
+
logger = createLogger("env:context:env-context");
|
|
192
|
+
envContextStorage = new AsyncLocalStorage;
|
|
193
|
+
setCurrentTaskId = wrapFunction(function _setCurrentTaskId(taskId) {
|
|
194
|
+
const prev = getCurrentTaskId();
|
|
195
|
+
const ctx = envContextStorage.getStore();
|
|
196
|
+
if (ctx) {
|
|
197
|
+
if (!ctx.agentContext) {
|
|
198
|
+
ctx.agentContext = {};
|
|
199
|
+
}
|
|
200
|
+
ctx.agentContext.currentTaskId = taskId;
|
|
201
|
+
}
|
|
202
|
+
logger.info(`[setCurrentTaskId] taskId=${taskId ?? "undefined"} (was: ${prev ?? "undefined"})`);
|
|
203
|
+
}, "env-context.setCurrentTaskId", { recordParams: true, recordResult: false, log: true });
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export { isLarkEvent, isGithubEvent, isJiraEvent, getLarkMessageId, getLarkChatId, getLarkUserId, EVENT_ENV_PREFIX, serializeEventToEnv, restoreEventFromEnv, init_env_event, envContextStorage, getEnvContext, getEnvContextOrEmpty, hasEnvContext, getCurrentTaskId, runWithEnvContext, runWithEnvContextAsync, createEnvContext, mergeEnvContext, setCurrentTaskId, getEventFromEnvContext, init_env_context };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseComponent
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-akb8mb9v.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-nna4s0qs.js";
|
|
12
12
|
|
|
13
13
|
// src/env/commands/commands-component.ts
|
|
14
14
|
import path2 from "path";
|