@ai-setting/roy-agent-core 1.7.32 → 1.7.33

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.
@@ -11,7 +11,7 @@ import {
11
11
  larkCliHandler,
12
12
  resolveBountyIMSystemPrompt,
13
13
  timerHandler
14
- } from "../../shared/@ai-setting/roy-agent-core-4csc7ars.js";
14
+ } from "../../shared/@ai-setting/roy-agent-core-jq8rmmm6.js";
15
15
  import"../../shared/@ai-setting/roy-agent-core-0nz53t5v.js";
16
16
  import {
17
17
  BUILT_IN_EVENT_SOURCE_TYPES,
@@ -22,7 +22,7 @@ import {
22
22
  isValidEventSourceType,
23
23
  validateEventSourceConfig
24
24
  } from "../../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
25
- import"../../shared/@ai-setting/roy-agent-core-9z6gcy77.js";
25
+ import"../../shared/@ai-setting/roy-agent-core-6f7cjzem.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
27
27
  import"../../shared/@ai-setting/roy-agent-core-skqt40yy.js";
28
28
  import"../../shared/@ai-setting/roy-agent-core-1df0grva.js";
@@ -30,7 +30,7 @@ import"../../shared/@ai-setting/roy-agent-core-jdvgzf2y.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
31
31
  import"../../shared/@ai-setting/roy-agent-core-jbc1t62x.js";
32
32
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
33
- import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
33
+ import"../../shared/@ai-setting/roy-agent-core-rmn29nrh.js";
34
34
  import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
35
35
  import"../../shared/@ai-setting/roy-agent-core-m725wp1x.js";
36
36
  import"../../shared/@ai-setting/roy-agent-core-sf4bjgwz.js";
package/dist/env/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseEnvironment
3
- } from "../shared/@ai-setting/roy-agent-core-4t6m600m.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-mssk8f0g.js";
4
4
  import {
5
5
  TaskComponent
6
6
  } from "../shared/@ai-setting/roy-agent-core-m09a4xwh.js";
@@ -15,7 +15,7 @@ import {
15
15
  EventSourceComponent,
16
16
  builtInHandlers,
17
17
  larkCliHandler
18
- } from "../shared/@ai-setting/roy-agent-core-4csc7ars.js";
18
+ } from "../shared/@ai-setting/roy-agent-core-jq8rmmm6.js";
19
19
  import"../shared/@ai-setting/roy-agent-core-0nz53t5v.js";
20
20
  import {
21
21
  EventSourceInitHooks,
@@ -24,7 +24,7 @@ import {
24
24
  isValidEventSourceType,
25
25
  validateEventSourceConfig
26
26
  } from "../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
27
- import"../shared/@ai-setting/roy-agent-core-9z6gcy77.js";
27
+ import"../shared/@ai-setting/roy-agent-core-6f7cjzem.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-skqt40yy.js";
30
30
  import {
@@ -69,8 +69,8 @@ import"../shared/@ai-setting/roy-agent-core-c1v263jn.js";
69
69
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
70
70
  import {
71
71
  PluginComponent
72
- } from "../shared/@ai-setting/roy-agent-core-0ra1gtn9.js";
73
- import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
72
+ } from "../shared/@ai-setting/roy-agent-core-bt7mg8j5.js";
73
+ import"../shared/@ai-setting/roy-agent-core-rmn29nrh.js";
74
74
  import {
75
75
  McpComponent
76
76
  } from "../shared/@ai-setting/roy-agent-core-gjnhkemk.js";
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  EventBusNotificationChannel,
3
3
  PluginComponent
4
- } from "../../shared/@ai-setting/roy-agent-core-0ra1gtn9.js";
4
+ } from "../../shared/@ai-setting/roy-agent-core-bt7mg8j5.js";
5
5
  import {
6
- BasePlugin
7
- } from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
6
+ BasePlugin,
7
+ normalizeLarkAtMentions
8
+ } from "../../shared/@ai-setting/roy-agent-core-rmn29nrh.js";
8
9
  import"../../shared/@ai-setting/roy-agent-core-m725wp1x.js";
9
10
  import"../../shared/@ai-setting/roy-agent-core-sf4bjgwz.js";
10
11
  import"../../shared/@ai-setting/roy-agent-core-g772q3gf.js";
@@ -64,6 +65,7 @@ ${options.content}`;
64
65
  return new Promise((resolve, reject) => {
65
66
  const { chatId, messageId, content, profile } = options;
66
67
  let args;
68
+ const normalizedContent = normalizeLarkAtMentions(content);
67
69
  if (messageId) {
68
70
  args = [
69
71
  "im",
@@ -71,7 +73,7 @@ ${options.content}`;
71
73
  "--message-id",
72
74
  messageId,
73
75
  "--markdown",
74
- content,
76
+ normalizedContent,
75
77
  "--as",
76
78
  "bot"
77
79
  ];
@@ -82,7 +84,7 @@ ${options.content}`;
82
84
  "--chat-id",
83
85
  chatId,
84
86
  "--markdown",
85
- content
87
+ normalizedContent
86
88
  ];
87
89
  }
88
90
  if (profile) {
@@ -10,7 +10,7 @@ import {
10
10
  formatExtractorInput,
11
11
  formatExtractorInputFromDescription,
12
12
  parseExtractorOutput
13
- } from "../../../shared/@ai-setting/roy-agent-core-9z6gcy77.js";
13
+ } from "../../../shared/@ai-setting/roy-agent-core-6f7cjzem.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-skqt40yy.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-1df0grva.js";
@@ -18,7 +18,7 @@ import"../../../shared/@ai-setting/roy-agent-core-jdvgzf2y.js";
18
18
  import"../../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
19
19
  import"../../../shared/@ai-setting/roy-agent-core-jbc1t62x.js";
20
20
  import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
21
- import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
21
+ import"../../../shared/@ai-setting/roy-agent-core-rmn29nrh.js";
22
22
  import"../../../shared/@ai-setting/roy-agent-core-m2pxg5d8.js";
23
23
  import"../../../shared/@ai-setting/roy-agent-core-7p6rny5m.js";
24
24
  import"../../../shared/@ai-setting/roy-agent-core-38rtrpk3.js";
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ import {
66
66
  BaseEnvironment,
67
67
  generateDescendingId,
68
68
  generateId
69
- } from "./shared/@ai-setting/roy-agent-core-4t6m600m.js";
69
+ } from "./shared/@ai-setting/roy-agent-core-mssk8f0g.js";
70
70
  import {
71
71
  TaskComponent
72
72
  } from "./shared/@ai-setting/roy-agent-core-m09a4xwh.js";
@@ -92,7 +92,7 @@ import {
92
92
  larkCliHandler,
93
93
  resolveBountyIMSystemPrompt,
94
94
  timerHandler
95
- } from "./shared/@ai-setting/roy-agent-core-4csc7ars.js";
95
+ } from "./shared/@ai-setting/roy-agent-core-jq8rmmm6.js";
96
96
  import {
97
97
  LogTraceComponent,
98
98
  LogTraceConfigSchema
@@ -109,7 +109,7 @@ import {
109
109
  import {
110
110
  TaskTagPlugin,
111
111
  createAutoTaskPlugin
112
- } from "./shared/@ai-setting/roy-agent-core-9z6gcy77.js";
112
+ } from "./shared/@ai-setting/roy-agent-core-6f7cjzem.js";
113
113
  import {
114
114
  TaskHookPoints
115
115
  } from "./shared/@ai-setting/roy-agent-core-1pg0fepg.js";
@@ -189,10 +189,10 @@ import {
189
189
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
190
190
  import {
191
191
  PluginComponent
192
- } from "./shared/@ai-setting/roy-agent-core-0ra1gtn9.js";
192
+ } from "./shared/@ai-setting/roy-agent-core-bt7mg8j5.js";
193
193
  import {
194
194
  BasePlugin
195
- } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
195
+ } from "./shared/@ai-setting/roy-agent-core-rmn29nrh.js";
196
196
  import {
197
197
  McpComponent
198
198
  } from "./shared/@ai-setting/roy-agent-core-gjnhkemk.js";
@@ -11,8 +11,9 @@ import {
11
11
  enqueueToAddFakeUserMessage
12
12
  } from "./roy-agent-core-jbc1t62x.js";
13
13
  import {
14
- BasePlugin
15
- } from "./roy-agent-core-az13yzmc.js";
14
+ BasePlugin,
15
+ normalizeLarkAtMentions
16
+ } from "./roy-agent-core-rmn29nrh.js";
16
17
  import {
17
18
  init_context
18
19
  } from "./roy-agent-core-m2pxg5d8.js";
@@ -556,6 +557,7 @@ ${content}`;
556
557
  return new Promise((resolve, reject) => {
557
558
  const { chatId, messageId, content, profile } = options;
558
559
  let args;
560
+ const normalizedContent = normalizeLarkAtMentions(content);
559
561
  if (messageId) {
560
562
  args = [
561
563
  "im",
@@ -563,7 +565,7 @@ ${content}`;
563
565
  "--message-id",
564
566
  messageId,
565
567
  "--markdown",
566
- content,
568
+ normalizedContent,
567
569
  "--as",
568
570
  "bot"
569
571
  ];
@@ -574,7 +576,7 @@ ${content}`;
574
576
  "--chat-id",
575
577
  chatId,
576
578
  "--markdown",
577
- content
579
+ normalizedContent
578
580
  ];
579
581
  }
580
582
  if (profile) {
@@ -1138,7 +1140,7 @@ class PerTaskGroupChatPlugin {
1138
1140
  "--chat-id",
1139
1141
  opts.chatId,
1140
1142
  "--markdown",
1141
- opts.content,
1143
+ normalizeLarkAtMentions(opts.content),
1142
1144
  "--as",
1143
1145
  "bot"
1144
1146
  ];
@@ -1175,9 +1177,9 @@ class PerTaskGroupChatPlugin {
1175
1177
  }
1176
1178
  sendToMain(replyChannel, opts) {
1177
1179
  return new Promise((resolve, reject) => {
1178
- const message = `${opts.title}
1180
+ const message = normalizeLarkAtMentions(`${opts.title}
1179
1181
 
1180
- ${opts.content}`;
1182
+ ${opts.content}`);
1181
1183
  const args = replyChannel.messageId ? ["im", "+messages-reply", "--message-id", replyChannel.messageId, "--markdown", message, "--as", "bot"] : ["im", "+messages-send", "--chat-id", replyChannel.chatId, "--markdown", message];
1182
1184
  if (opts.profile) {
1183
1185
  args.unshift("--profile", opts.profile);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BasePlugin
3
- } from "./roy-agent-core-az13yzmc.js";
3
+ } from "./roy-agent-core-rmn29nrh.js";
4
4
  import {
5
5
  BaseComponent
6
6
  } from "./roy-agent-core-m725wp1x.js";
@@ -2,7 +2,10 @@ import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook,
4
4
  createPerTaskGroupChatPlugin
5
- } from "./roy-agent-core-9z6gcy77.js";
5
+ } from "./roy-agent-core-6f7cjzem.js";
6
+ import {
7
+ normalizeLarkAtMentions
8
+ } from "./roy-agent-core-rmn29nrh.js";
6
9
  import {
7
10
  envKeyToConfigKey
8
11
  } from "./roy-agent-core-7hh0brvs.js";
@@ -1437,14 +1440,15 @@ class LarkCliInstance {
1437
1440
  async sendLarkMessage(options) {
1438
1441
  return new Promise((resolve, reject) => {
1439
1442
  const { chatId, userId, messageId, content, as: identity, format = "text", profile } = options;
1443
+ const normalizedContent = normalizeLarkAtMentions(content);
1440
1444
  const contentFlag = format === "markdown" ? "--markdown" : "--text";
1441
1445
  const args = ["im"];
1442
1446
  if (messageId) {
1443
- args.push("+messages-reply", "--message-id", messageId, "--as", identity, contentFlag, content);
1447
+ args.push("+messages-reply", "--message-id", messageId, "--as", identity, contentFlag, normalizedContent);
1444
1448
  } else if (chatId) {
1445
- args.push("+messages-send", "--chat-id", chatId, "--as", identity, contentFlag, content);
1449
+ args.push("+messages-send", "--chat-id", chatId, "--as", identity, contentFlag, normalizedContent);
1446
1450
  } else if (userId) {
1447
- args.push("+messages-send", "--user-id", userId, "--as", identity, contentFlag, content);
1451
+ args.push("+messages-send", "--user-id", userId, "--as", identity, contentFlag, normalizedContent);
1448
1452
  } else {
1449
1453
  reject(new Error("No target specified for sending message"));
1450
1454
  return;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-9z6gcy77.js";
3
+ } from "./roy-agent-core-6f7cjzem.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -0,0 +1,34 @@
1
+ // src/env/plugin/types.ts
2
+ class BasePlugin {
3
+ version = "1.0.0";
4
+ description;
5
+ priority = 0;
6
+ constructor() {}
7
+ init(env) {}
8
+ dispose() {}
9
+ }
10
+
11
+ // src/env/lark-mention-utils.ts
12
+ var SELF_CLOSING_AT_RE = /<at\s+user_id\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+))\s*\/\s*>/g;
13
+ function normalizeLarkAtMentions(content, nameMap) {
14
+ if (!content)
15
+ return content;
16
+ return content.replace(SELF_CLOSING_AT_RE, (_match, dq, sq, bare) => {
17
+ const userId = dq ?? sq ?? bare ?? "";
18
+ if (!userId)
19
+ return _match;
20
+ const displayName = nameMap?.get(userId);
21
+ if (displayName) {
22
+ return `<at user_id="${escapeXmlAttr(userId)}">${escapeXmlText(displayName)}</at>`;
23
+ }
24
+ return `<at user_id="${escapeXmlAttr(userId)}"></at>`;
25
+ });
26
+ }
27
+ function escapeXmlAttr(value) {
28
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
29
+ }
30
+ function escapeXmlText(value) {
31
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
32
+ }
33
+
34
+ export { BasePlugin, normalizeLarkAtMentions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.7.32",
3
+ "version": "1.7.33",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",
@@ -1,11 +0,0 @@
1
- // src/env/plugin/types.ts
2
- class BasePlugin {
3
- version = "1.0.0";
4
- description;
5
- priority = 0;
6
- constructor() {}
7
- init(env) {}
8
- dispose() {}
9
- }
10
-
11
- export { BasePlugin };