@ai-setting/roy-agent-core 1.5.109 → 1.6.0

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.
@@ -2,7 +2,7 @@ import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema,
4
4
  SummaryAgent
5
- } from "../../shared/@ai-setting/roy-agent-core-y8fvmh8q.js";
5
+ } from "../../shared/@ai-setting/roy-agent-core-fzkfkd28.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-a8pm6hya.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
@@ -10,7 +10,7 @@ import {
10
10
  larkCliHandler,
11
11
  resolveBountyIMSystemPrompt,
12
12
  timerHandler
13
- } from "../../shared/@ai-setting/roy-agent-core-ks3nm336.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-q79q54x2.js";
14
14
  import {
15
15
  BUILT_IN_EVENT_SOURCE_TYPES,
16
16
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -21,7 +21,7 @@ import {
21
21
  validateEventSourceConfig
22
22
  } from "../../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
23
23
  import"../../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
24
- import"../../shared/@ai-setting/roy-agent-core-btpjdb97.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-8cezq5x9.js";
25
25
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
27
27
  import"../../shared/@ai-setting/roy-agent-core-4yq23m5g.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-ftdapf99.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-vrn9qj8y.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-ks3nm336.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-q79q54x2.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,7 +17,7 @@ import"../shared/@ai-setting/roy-agent-core-wmkx79b1.js";
17
17
  import {
18
18
  PluginComponent
19
19
  } from "../shared/@ai-setting/roy-agent-core-z7dxedn6.js";
20
- import"../shared/@ai-setting/roy-agent-core-btpjdb97.js";
20
+ import"../shared/@ai-setting/roy-agent-core-8cezq5x9.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
@@ -41,7 +41,7 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
41
41
  import {
42
42
  AgentComponent,
43
43
  AgentComponentConfigSchema
44
- } from "../shared/@ai-setting/roy-agent-core-y8fvmh8q.js";
44
+ } from "../shared/@ai-setting/roy-agent-core-fzkfkd28.js";
45
45
  import"../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
46
46
  import"../shared/@ai-setting/roy-agent-core-a8pm6hya.js";
47
47
  import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
@@ -8,7 +8,7 @@ import {
8
8
  formatExtractorInput,
9
9
  formatExtractorInputFromDescription,
10
10
  parseExtractorOutput
11
- } from "../../../shared/@ai-setting/roy-agent-core-btpjdb97.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-8cezq5x9.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-8wd3qwx5.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-4yq23m5g.js";
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-ftdapf99.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-vrn9qj8y.js";
66
66
  import {
67
67
  BountyIMInstance,
68
68
  EventSourceComponent,
@@ -74,7 +74,7 @@ import {
74
74
  larkCliHandler,
75
75
  resolveBountyIMSystemPrompt,
76
76
  timerHandler
77
- } from "./shared/@ai-setting/roy-agent-core-ks3nm336.js";
77
+ } from "./shared/@ai-setting/roy-agent-core-q79q54x2.js";
78
78
  import {
79
79
  BUILT_IN_EVENT_SOURCE_TYPES,
80
80
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -94,7 +94,7 @@ import {
94
94
  import {
95
95
  TaskTagPlugin,
96
96
  createAutoTaskPlugin
97
- } from "./shared/@ai-setting/roy-agent-core-btpjdb97.js";
97
+ } from "./shared/@ai-setting/roy-agent-core-8cezq5x9.js";
98
98
  import {
99
99
  BasePlugin
100
100
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
@@ -129,7 +129,7 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
129
129
  import {
130
130
  AgentComponent,
131
131
  AgentComponentConfigSchema
132
- } from "./shared/@ai-setting/roy-agent-core-y8fvmh8q.js";
132
+ } from "./shared/@ai-setting/roy-agent-core-fzkfkd28.js";
133
133
  import {
134
134
  createInvokeConfig,
135
135
  invoke,
@@ -332,11 +332,22 @@ function createAutoTaskPlugin(config) {
332
332
  logger2.debug(`[AutoTaskPlugin] new query detected (traceId=${traceId.slice(0, 20)}...)`);
333
333
  const reminderContent = `⚠️ **系统提醒**: 你已经调用了 ${ctx.iteration} 次工具,达到 iteration 阈值(默认 ${threshold})。
334
334
  ` + `当前请求较为复杂,建议通过 \`delegate_task\` 工具将整个任务委托给 \`roy\` sub-agent 处理。`;
335
- ctx.messages.push({
335
+ if (!ctx.toolResult) {
336
+ logger2.warn(`[AutoTaskPlugin] toolResult missing, skip meta-protocol (iteration=${ctx.iteration})`);
337
+ return { continue: true };
338
+ }
339
+ if (!ctx.toolResult.result) {
340
+ ctx.toolResult.result = {};
341
+ }
342
+ const innerResult = ctx.toolResult.result;
343
+ if (!innerResult.metadata) {
344
+ innerResult.metadata = {};
345
+ }
346
+ innerResult.metadata.toAddFakeUserMessage = {
336
347
  role: "user",
337
348
  content: reminderContent
338
- });
339
- logger2.info(`[AutoTaskPlugin] user reminder pushed (session=${(ctx.context?.sessionId ?? "unknown").slice(0, 12)}..., iteration=${ctx.iteration})`);
349
+ };
350
+ logger2.info(`[AutoTaskPlugin] user reminder meta-protocol set (session=${(ctx.context?.sessionId ?? "unknown").slice(0, 12)}..., iteration=${ctx.iteration})`);
340
351
  return { continue: true };
341
352
  } catch (err) {
342
353
  logger2.error(`[AutoTaskPlugin] hook failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -350,8 +361,8 @@ function createAutoTaskPlugin(config) {
350
361
  });
351
362
  return {
352
363
  name: "AutoTaskPlugin",
353
- version: "5.0.0",
354
- description: "ReAct iteration 达到阈值时向 LLM 推送 user 消息提醒其通过 delegate_task 委托给 roy",
364
+ version: "5.1.0",
365
+ description: "ReAct iteration 达到阈值时通过 ToolResult.metadata.toAddFakeUserMessage meta-protocol 注入 user 消息(在 tool result 之后追加,保证 tool_call/tool_result 相邻)",
355
366
  hooks: [
356
367
  { point: "agent:after.tool", priority: 50 }
357
368
  ],
@@ -883,6 +883,17 @@ class AgentComponent extends BaseComponent {
883
883
  output: toolOutput
884
884
  }]
885
885
  });
886
+ {
887
+ const toolResultMeta = hookCtx.toolResult?.result?.metadata;
888
+ if (toolResultMeta && "toAddFakeUserMessage" in toolResultMeta) {
889
+ const userMsg = toolResultMeta.toAddFakeUserMessage;
890
+ if (userMsg && userMsg.role === "user") {
891
+ this.pushMessage(hookCtx, userMsg);
892
+ logger.debug(`[ReAct] Meta-protocol: appended user message after tool result (tool=${toolResult.name}, iter=${iteration})`);
893
+ delete toolResultMeta.toAddFakeUserMessage;
894
+ }
895
+ }
896
+ }
886
897
  result.toolCalls.push(hookCtx.currentToolCall);
887
898
  processedCount++;
888
899
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-btpjdb97.js";
4
+ } from "./roy-agent-core-8cezq5x9.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-btpjdb97.js";
3
+ } from "./roy-agent-core-8cezq5x9.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.109",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",