@ai-setting/roy-agent-core 1.6.2 → 1.6.3

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.
Files changed (24) hide show
  1. package/dist/env/agent/index.js +2 -2
  2. package/dist/env/event-source/index.js +3 -3
  3. package/dist/env/index.js +10 -10
  4. package/dist/env/llm/index.js +2 -2
  5. package/dist/env/prompt/index.js +2 -2
  6. package/dist/env/task/delegate/index.js +2 -2
  7. package/dist/env/task/index.js +3 -3
  8. package/dist/env/task/plugins/index.js +2 -2
  9. package/dist/env/workflow/engine/index.js +1 -1
  10. package/dist/env/workflow/index.js +2 -2
  11. package/dist/index.js +12 -12
  12. package/dist/shared/@ai-setting/{roy-agent-core-fg5eaht3.js → roy-agent-core-155408xq.js} +1 -1
  13. package/dist/shared/@ai-setting/{roy-agent-core-2t2n1epb.js → roy-agent-core-45tvcwwz.js} +1 -1
  14. package/dist/shared/@ai-setting/{roy-agent-core-j7jeqxhd.js → roy-agent-core-65qs21kf.js} +3 -3
  15. package/dist/shared/@ai-setting/{roy-agent-core-gexpbexm.js → roy-agent-core-6ve6tsm5.js} +1 -1
  16. package/dist/shared/@ai-setting/{roy-agent-core-gzzvcmg3.js → roy-agent-core-78m47x1d.js} +2 -8
  17. package/dist/shared/@ai-setting/{roy-agent-core-te3hf26b.js → roy-agent-core-7afcdb2m.js} +1 -1
  18. package/dist/shared/@ai-setting/{roy-agent-core-ekptge19.js → roy-agent-core-8mqahsj5.js} +1 -1
  19. package/dist/shared/@ai-setting/{roy-agent-core-97x9ymda.js → roy-agent-core-anhvbnrc.js} +20 -1
  20. package/dist/shared/@ai-setting/{roy-agent-core-1k7z350s.js → roy-agent-core-g7hfkszj.js} +1 -1
  21. package/dist/shared/@ai-setting/{roy-agent-core-j25z80xr.js → roy-agent-core-pr7f94gn.js} +1 -1
  22. package/dist/shared/@ai-setting/{roy-agent-core-47py6rej.js → roy-agent-core-xxfkvqqh.js} +20 -2
  23. package/dist/shared/@ai-setting/{roy-agent-core-9378eq5y.js → roy-agent-core-z9m38ytb.js} +39 -22
  24. package/package.json +1 -1
@@ -2,8 +2,8 @@ import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema,
4
4
  SummaryAgent
5
- } from "../../shared/@ai-setting/roy-agent-core-47py6rej.js";
6
- import"../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
5
+ } from "../../shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
6
+ import"../../shared/@ai-setting/roy-agent-core-65qs21kf.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-6kygfd9x.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
@@ -10,7 +10,7 @@ import {
10
10
  larkCliHandler,
11
11
  resolveBountyIMSystemPrompt,
12
12
  timerHandler
13
- } from "../../shared/@ai-setting/roy-agent-core-2t2n1epb.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-45tvcwwz.js";
14
14
  import {
15
15
  BUILT_IN_EVENT_SOURCE_TYPES,
16
16
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -21,11 +21,11 @@ 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-gexpbexm.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-6ve6tsm5.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";
28
- import"../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
28
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
29
29
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
31
31
  import"../../shared/@ai-setting/roy-agent-core-pf1c360e.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-97x9ymda.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-anhvbnrc.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-2t2n1epb.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-45tvcwwz.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,13 +17,13 @@ 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-gexpbexm.js";
20
+ import"../shared/@ai-setting/roy-agent-core-6ve6tsm5.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-ekptge19.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-8mqahsj5.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
26
- import"../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
26
+ import"../shared/@ai-setting/roy-agent-core-78m47x1d.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -41,20 +41,20 @@ 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-47py6rej.js";
45
- import"../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
44
+ } from "../shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
45
+ import"../shared/@ai-setting/roy-agent-core-65qs21kf.js";
46
46
  import"../shared/@ai-setting/roy-agent-core-6kygfd9x.js";
47
47
  import"../shared/@ai-setting/roy-agent-core-5h49ct1a.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
49
49
  import {
50
50
  TaskComponent
51
- } from "../shared/@ai-setting/roy-agent-core-j25z80xr.js";
51
+ } from "../shared/@ai-setting/roy-agent-core-pr7f94gn.js";
52
52
  import"../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
53
53
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
54
- import"../shared/@ai-setting/roy-agent-core-te3hf26b.js";
54
+ import"../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
55
55
  import"../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
56
56
  import"../shared/@ai-setting/roy-agent-core-9xby523m.js";
57
- import"../shared/@ai-setting/roy-agent-core-9378eq5y.js";
57
+ import"../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
58
58
  import"../shared/@ai-setting/roy-agent-core-as3phr7n.js";
59
59
  import {
60
60
  XDG_PATHS,
@@ -8,14 +8,14 @@ import {
8
8
  ProviderCapabilitiesSchema,
9
9
  ProviderConfigSchema,
10
10
  ProviderManager
11
- } from "../../shared/@ai-setting/roy-agent-core-fg5eaht3.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-155408xq.js";
12
12
  import {
13
13
  convertToSDKMessages,
14
14
  createInvokeConfig,
15
15
  invoke,
16
16
  invokeNonStream,
17
17
  parseModelString
18
- } from "../../shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
18
+ } from "../../shared/@ai-setting/roy-agent-core-65qs21kf.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-8x4ngxcy.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-1k7z350s.js";
7
- import"../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-g7hfkszj.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-pf1c360e.js";
@@ -3,9 +3,9 @@ import {
3
3
  BackgroundTaskManager,
4
4
  createDelegateTool,
5
5
  createStopTool
6
- } from "../../../shared/@ai-setting/roy-agent-core-te3hf26b.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-as3phr7n.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
@@ -5,18 +5,18 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-j25z80xr.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-pr7f94gn.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
10
10
  import {
11
11
  TaskEntityEventTypes
12
12
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
13
- import"../../shared/@ai-setting/roy-agent-core-te3hf26b.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-7afcdb2m.js";
14
14
  import"../../shared/@ai-setting/roy-agent-core-pzeexnhf.js";
15
15
  import {
16
16
  SQLiteTaskStore,
17
17
  getDefaultTaskDbPath
18
18
  } from "../../shared/@ai-setting/roy-agent-core-9xby523m.js";
19
- import"../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-as3phr7n.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
22
22
  import"../../shared/@ai-setting/roy-agent-core-0ye4q2jj.js";
@@ -8,11 +8,11 @@ import {
8
8
  formatExtractorInput,
9
9
  formatExtractorInputFromDescription,
10
10
  parseExtractorOutput
11
- } from "../../../shared/@ai-setting/roy-agent-core-gexpbexm.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-6ve6tsm5.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";
15
- import"../../../shared/@ai-setting/roy-agent-core-9378eq5y.js";
15
+ import"../../../shared/@ai-setting/roy-agent-core-z9m38ytb.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
17
17
  import"../../../shared/@ai-setting/roy-agent-core-zttjq1h3.js";
18
18
  import"../../../shared/@ai-setting/roy-agent-core-scp0afxg.js";
@@ -5,7 +5,7 @@ import {
5
5
  Scheduler,
6
6
  WorkflowEngine,
7
7
  init_engine
8
- } from "../../../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-78m47x1d.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-ekptge19.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-8mqahsj5.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-xgnpr28w.js";
5
- import"../../shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-78m47x1d.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-vf72n6qn.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-q88vxmx5.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PromptComponent,
3
3
  PromptStore
4
- } from "./shared/@ai-setting/roy-agent-core-1k7z350s.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-g7hfkszj.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -9,7 +9,7 @@ import {
9
9
  ModelLimitsSchema,
10
10
  ProviderCapabilitiesSchema,
11
11
  ProviderConfigSchema
12
- } from "./shared/@ai-setting/roy-agent-core-fg5eaht3.js";
12
+ } from "./shared/@ai-setting/roy-agent-core-155408xq.js";
13
13
  import {
14
14
  ConfigComponent
15
15
  } from "./shared/@ai-setting/roy-agent-core-33rhv946.js";
@@ -62,7 +62,7 @@ import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-97x9ymda.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-anhvbnrc.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-2t2n1epb.js";
77
+ } from "./shared/@ai-setting/roy-agent-core-45tvcwwz.js";
78
78
  import {
79
79
  BUILT_IN_EVENT_SOURCE_TYPES,
80
80
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -94,18 +94,18 @@ import {
94
94
  import {
95
95
  TaskTagPlugin,
96
96
  createAutoTaskPlugin
97
- } from "./shared/@ai-setting/roy-agent-core-gexpbexm.js";
97
+ } from "./shared/@ai-setting/roy-agent-core-6ve6tsm5.js";
98
98
  import {
99
99
  BasePlugin
100
100
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
101
101
  import {
102
102
  WorkflowComponent
103
- } from "./shared/@ai-setting/roy-agent-core-ekptge19.js";
103
+ } from "./shared/@ai-setting/roy-agent-core-8mqahsj5.js";
104
104
  import {
105
105
  init_node_registry_helper,
106
106
  registerDecoratorNodeType
107
107
  } from "./shared/@ai-setting/roy-agent-core-xgnpr28w.js";
108
- import"./shared/@ai-setting/roy-agent-core-gzzvcmg3.js";
108
+ import"./shared/@ai-setting/roy-agent-core-78m47x1d.js";
109
109
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
110
110
  import"./shared/@ai-setting/roy-agent-core-vf72n6qn.js";
111
111
  import"./shared/@ai-setting/roy-agent-core-q88vxmx5.js";
@@ -129,13 +129,13 @@ 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-47py6rej.js";
132
+ } from "./shared/@ai-setting/roy-agent-core-xxfkvqqh.js";
133
133
  import {
134
134
  createInvokeConfig,
135
135
  invoke,
136
136
  invokeNonStream,
137
137
  parseModelString
138
- } from "./shared/@ai-setting/roy-agent-core-j7jeqxhd.js";
138
+ } from "./shared/@ai-setting/roy-agent-core-65qs21kf.js";
139
139
  import {
140
140
  ToolComponent,
141
141
  ToolRegistry,
@@ -148,10 +148,10 @@ import {
148
148
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
149
149
  import {
150
150
  TaskComponent
151
- } from "./shared/@ai-setting/roy-agent-core-j25z80xr.js";
151
+ } from "./shared/@ai-setting/roy-agent-core-pr7f94gn.js";
152
152
  import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
153
153
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
154
- import"./shared/@ai-setting/roy-agent-core-te3hf26b.js";
154
+ import"./shared/@ai-setting/roy-agent-core-7afcdb2m.js";
155
155
  import"./shared/@ai-setting/roy-agent-core-pzeexnhf.js";
156
156
  import {
157
157
  SQLiteTaskStore,
@@ -160,7 +160,7 @@ import {
160
160
  import {
161
161
  getBuiltInPrompt,
162
162
  getBuiltInPromptNames
163
- } from "./shared/@ai-setting/roy-agent-core-9378eq5y.js";
163
+ } from "./shared/@ai-setting/roy-agent-core-z9m38ytb.js";
164
164
  import {
165
165
  AgentRegistry
166
166
  } from "./shared/@ai-setting/roy-agent-core-as3phr7n.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  invoke
3
- } from "./roy-agent-core-j7jeqxhd.js";
3
+ } from "./roy-agent-core-65qs21kf.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-gexpbexm.js";
4
+ } from "./roy-agent-core-6ve6tsm5.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.js";
@@ -330,8 +330,8 @@ function convertToolChoice(toolChoice) {
330
330
  return { type: "tool", toolName };
331
331
  }
332
332
  function createEnvEventEmitter(env, context) {
333
- if (!env) {
334
- logger.warn("[invoke] createEnvEventEmitter: env is null/undefined, streaming events will be disabled");
333
+ if (!env || typeof env.pushEnvEvent !== "function") {
334
+ logger.warn("[invoke] createEnvEventEmitter: env is null/undefined or pushEnvEvent is unavailable, streaming events will be disabled");
335
335
  return null;
336
336
  }
337
337
  return (event) => {
@@ -721,7 +721,7 @@ async function invokeNonStream(config, options, ctx) {
721
721
  completionTokens: usage.completionTokens ?? 0,
722
722
  totalTokens: usage.totalTokens ?? 0
723
723
  } : undefined;
724
- if (options.env) {
724
+ if (options.env && typeof options.env.pushEnvEvent === "function") {
725
725
  options.env.pushEnvEvent({
726
726
  id: randomUUID(),
727
727
  type: "llm.completed",
@@ -6,7 +6,7 @@ import {
6
6
  } from "./roy-agent-core-8wd3qwx5.js";
7
7
  import {
8
8
  WORKFLOW_EXTRACT_PROMPT
9
- } from "./roy-agent-core-9378eq5y.js";
9
+ } from "./roy-agent-core-z9m38ytb.js";
10
10
  import {
11
11
  TaskHookPoints
12
12
  } from "./roy-agent-core-1pg0fepg.js";
@@ -2071,16 +2071,10 @@ var init_engine = __esm(() => {
2071
2071
  const durationMs = Date.now() - sessionState.startedAt.getTime();
2072
2072
  const sessionId = sessionState.sessionId;
2073
2073
  const runId = this.getRunIdFromSessionId(sessionId);
2074
- const dagAnalysis = sessionState.dagManager.analyze();
2075
- const exitNodes = new Set(dagAnalysis.exitNodes);
2076
- const exitOutput = {};
2074
+ const finalOutput = {};
2077
2075
  for (const [nodeId, nodeOutput] of sessionState.nodeOutputs) {
2078
- if (exitNodes.has(nodeId)) {
2079
- exitOutput[nodeId] = nodeOutput;
2080
- }
2076
+ finalOutput[nodeId] = nodeOutput;
2081
2077
  }
2082
- const singleExit = exitNodes.size === 1 ? Array.from(exitNodes)[0] : undefined;
2083
- const finalOutput = singleExit && exitOutput[singleExit] !== undefined ? exitOutput[singleExit] : exitOutput;
2084
2078
  const allNodeOutputs = {};
2085
2079
  for (const [nodeId, nodeOutput] of sessionState.nodeOutputs) {
2086
2080
  allNodeOutputs[nodeId] = nodeOutput;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-pzeexnhf.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-9378eq5y.js";
7
+ } from "./roy-agent-core-z9m38ytb.js";
8
8
  import {
9
9
  DEFAULT_SUBAGENT_PROMPT
10
10
  } from "./roy-agent-core-as3phr7n.js";
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-gzzvcmg3.js";
9
+ } from "./roy-agent-core-78m47x1d.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-gexpbexm.js";
3
+ } from "./roy-agent-core-6ve6tsm5.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -49,6 +49,15 @@ init_env_context();
49
49
  import * as fsSync from "fs";
50
50
  import * as path from "path";
51
51
  var logger = createLogger("environment");
52
+ var DEFAULT_AGENT_NAME = "Roy";
53
+ function injectAgentNamePlaceholder(prompt, context) {
54
+ if (!prompt.includes("{{agent_name}}")) {
55
+ return prompt;
56
+ }
57
+ const metadata = context?.metadata;
58
+ const defaultAgentName = typeof metadata?.defaultAgentName === "string" && metadata.defaultAgentName.length > 0 ? metadata.defaultAgentName : DEFAULT_AGENT_NAME;
59
+ return prompt.replace(/\{\{agent_name\}\}/g, defaultAgentName);
60
+ }
52
61
 
53
62
  class BaseEnvironment extends BaseComponent {
54
63
  name;
@@ -146,6 +155,15 @@ class BaseEnvironment extends BaseComponent {
146
155
  finalSystemPrompt = finalSystemPrompt.replace("{{workspace_dir}}", workspaceDir);
147
156
  logger.debug(`[handle_query] Injected workspace_dir: ${workspaceDir}`);
148
157
  }
158
+ {
159
+ const prev = finalSystemPrompt;
160
+ finalSystemPrompt = injectAgentNamePlaceholder(finalSystemPrompt, context);
161
+ if (prev !== finalSystemPrompt) {
162
+ const metadata = context?.metadata;
163
+ const injectedName = typeof metadata?.defaultAgentName === "string" && metadata.defaultAgentName.length > 0 ? metadata.defaultAgentName : DEFAULT_AGENT_NAME;
164
+ logger.debug(`[handle_query] Injected agent_name: ${injectedName}`);
165
+ }
166
+ }
149
167
  let agent = agentComponent.getAgent(agentName);
150
168
  if (!agent) {
151
169
  if (agentName !== "default") {
@@ -221,6 +239,7 @@ class BaseEnvironment extends BaseComponent {
221
239
  if (agent.config.systemPrompt.includes("{{workspace_dir}}")) {
222
240
  agent.config.systemPrompt = agent.config.systemPrompt.replace("{{workspace_dir}}", process.cwd());
223
241
  }
242
+ agent.config.systemPrompt = injectAgentNamePlaceholder(agent.config.systemPrompt, context);
224
243
  }
225
244
  logger.debug(`[handle_query] Injected memory/workspace_dir for existing agent: ${agentName}`);
226
245
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInPrompts
3
- } from "./roy-agent-core-9378eq5y.js";
3
+ } from "./roy-agent-core-z9m38ytb.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -8,7 +8,7 @@ import {
8
8
  BackgroundTaskManager,
9
9
  createDelegateTool,
10
10
  createStopTool
11
- } from "./roy-agent-core-te3hf26b.js";
11
+ } from "./roy-agent-core-7afcdb2m.js";
12
12
  import {
13
13
  SQLiteTaskStore,
14
14
  getDefaultTaskDbPath
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTimeout
3
- } from "./roy-agent-core-j7jeqxhd.js";
3
+ } from "./roy-agent-core-65qs21kf.js";
4
4
  import {
5
5
  truncateOutputInline
6
6
  } from "./roy-agent-core-6kygfd9x.js";
@@ -76,6 +76,8 @@ var AGENT_CONFIG_REGISTRATION = {
76
76
  { key: "agent.defaultAgent.systemPrompt", sources: ["env", "file"] },
77
77
  { key: "agent.defaultAgent.streaming", sources: ["env", "file"] },
78
78
  { key: "agent.defaultAgent.tools", sources: ["env", "file"] },
79
+ { key: "agent.defaultAgent.allowedTools", sources: ["env", "file"] },
80
+ { key: "agent.defaultAgent.deniedTools", sources: ["env", "file"] },
79
81
  { key: "agent.defaultAgent.maxErrorRetries", sources: ["env", "file"] },
80
82
  { key: "agent.defaultAgent.filterHistory", sources: ["env", "file"] }
81
83
  ]
@@ -86,6 +88,20 @@ init_decorator();
86
88
  init_global_hook_manager();
87
89
  init_context();
88
90
  init_workflow_hil();
91
+ function parseToolList(v) {
92
+ if (v === undefined || v === null) {
93
+ return;
94
+ }
95
+ if (Array.isArray(v)) {
96
+ const arr = v.filter((x) => typeof x === "string");
97
+ return arr.length > 0 ? arr : undefined;
98
+ }
99
+ if (typeof v === "string") {
100
+ const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
101
+ return parts.length > 0 ? parts : undefined;
102
+ }
103
+ return;
104
+ }
89
105
  var logger = createLogger("agent:component");
90
106
  function toLLMMessage(msg) {
91
107
  let content;
@@ -304,7 +320,9 @@ class AgentComponent extends BaseComponent {
304
320
  type: constructorDefaultAgent?.type ?? configComponent.get("agent.defaultAgent.type") ?? "primary",
305
321
  systemPrompt: constructorDefaultAgent?.systemPrompt ?? configComponent.get("agent.defaultAgent.systemPrompt"),
306
322
  model: constructorDefaultAgent?.model ?? configComponent.get("agent.defaultAgent.model"),
307
- behaviorSpecId: constructorDefaultAgent?.behaviorSpecId ?? configComponent.get("agent.defaultAgent.behaviorSpecId")
323
+ behaviorSpecId: constructorDefaultAgent?.behaviorSpecId ?? configComponent.get("agent.defaultAgent.behaviorSpecId"),
324
+ allowedTools: parseToolList(constructorDefaultAgent?.allowedTools ?? configComponent.get("agent.defaultAgent.allowedTools")),
325
+ deniedTools: parseToolList(constructorDefaultAgent?.deniedTools ?? configComponent.get("agent.defaultAgent.deniedTools"))
308
326
  };
309
327
  logger.info(`[registerConfig] Synced config from ConfigComponent: maxIterations=${this.config.defaultAgent.maxIterations}`);
310
328
  this.registerConfigWatcher(configComponent);
@@ -1,6 +1,16 @@
1
1
  // src/env/prompt/prompts-index.ts
2
2
  var builtInPrompts = {
3
- default: `你是 Roy 接待智能体(Receptionist Agent)—— Roy 系统的智能入口。
3
+ default: `你是 {{agent_name}} 接待智能体(Receptionist Agent)—— {{agent_name}} 系统的智能入口。
4
+
5
+ ## ⚠️ 重要澄清:关于本 prompt 中的工具引用
6
+
7
+ > **本 prompt 中部分段落(如 \`delegate_task(...)\` 调用模板、行为规则 6 里的引用)是**你转交给 sub-agent(通常是 \`roy\`)的示例指令**,不代表你自己能直接调用其中提到的所有工具**。
8
+ >
9
+ > 具体来说:
10
+ > - \`delegate_task(...)\` 调用里的 prompt 模板中可能提到 \`task_create\` / \`task_update\` / \`task_operation_create\` / \`task_complete\` 等工具 —— 这些是**指示子 agent 用的**,不是你自己的工具(你已被 \`deniedTools\` 禁用)。
11
+ > - 你**自己**真正可用的工具,**严格以下方"## 你的工具"区块中的工具表为准**。
12
+ >
13
+ > 如果你读到 prompt 里有工具名但下方工具表里没有该工具 —— **不要尝试调用**,那是给子 agent 的示例。
4
14
 
5
15
  ## 工作目录
6
16
 
@@ -8,13 +18,13 @@ var builtInPrompts = {
8
18
 
9
19
  ## 你的身份
10
20
 
11
- - **名称**: Roy(接待员)
21
+ - **名称**: {{agent_name}}(接待员)
12
22
  - **角色**: 入口 AI 助手,分析用户请求并将其委托给合适的子智能体执行
13
23
  - **个性**: 友好、善于分析、高效、简洁
14
24
 
15
25
  ## 核心使命
16
26
 
17
- 你是 Roy 系统的**前门**。你的工作只有:
27
+ 你是 {{agent_name}} 系统的**前门**。你的工作只有:
18
28
 
19
29
  1. **倾听** 用户的请求
20
30
  2. **分析** 需要做什么
@@ -95,7 +105,7 @@ var builtInPrompts = {
95
105
  你有两个子智能体。**默认首次委托使用 \`roy\`**。仅在需要严格 Plan→Execute→Verify 纪律时使用 \`strict-task-agent\`。
96
106
 
97
107
  ### \uD83E\uDD47 首选:\`roy\`(首次委托默认)
98
- 全功能的 Roy AI 助手,拥有所有工具和技能,提示词中内置了 **任务作为一等公民** 原则。遵循结构化任务生命周期(创建→跟踪→完成),同时保持灵活性。
108
+ 全功能的 {{agent_name}} AI 助手,拥有所有工具和技能,提示词中内置了 **任务作为一等公民** 原则。遵循结构化任务生命周期(创建→跟踪→完成),同时保持灵活性。
99
109
  - ✅ 通用问题解决
100
110
  - ✅ 代码探索、阅读和分析
101
111
  - ✅ 创造性/探索性工作,可迭代优化
@@ -693,11 +703,18 @@ roy-agent <command> <subcmd> --help
693
703
  | \`task_list\` | List tasks with optional filters for status/priority |
694
704
  | \`task_complete\` | Mark a task as completed (progress=100, status=completed). Creates an operation record. |
695
705
  | \`task_delete\` | Delete a task and all its operation records |
696
- | \`delegate_task\` | Delegate complex tasks to a sub-agent (always background mode) |
697
- | \`stop_task\` | Stop a running background task |
698
706
  | \`task_operation_create\` | Create operation records to track progress/milestones |
699
707
  | \`task_operation_list\` | List operation records for a task |
700
708
 
709
+ ### ❌ 禁止使用的工具(你不能调用以下工具)
710
+
711
+ > 这些工具在你的 \`deniedTools\` 白名单里被禁用了。即使 prompt 提到它们,**你也不能调用**。
712
+
713
+ | 工具 | 为什么禁用 | 你应该怎么做 |
714
+ |------|-----------|-------------|
715
+ | \`delegate_task\` | 子 agent 委托入口,由 \`default\` 接待员独占 | 直接用 \`bash\` / \`read_file\` / \`edit_file\` 等工具自己完成任务;若是真正的复杂多步任务,建议用户切换到 \`default\` agent |
716
+ | \`stop_task\` | 后台进程管理入口,由 \`default\` 接待员独占 | 你无法启动后台进程,自然不需要 \`stop_task\` |
717
+
701
718
  ### Task Lifecycle
702
719
 
703
720
  Follow this lifecycle for every task:
@@ -734,18 +751,18 @@ Follow this lifecycle for every task:
734
751
  └─────────────────────────────────────────────────────────────────┘
735
752
 
736
753
  ┌─────────────────────────────────────────────────────────────────┐
737
- │ 3. EXECUTE (delegate_task)
738
- │ - delegate_task 总是后台执行,立即返回
739
- - 通过返回的 task_id 主动用 task_get 查询进度
754
+ │ 3. EXECUTE
755
+ │ - 利用各种工具和能力,skill,workflow等来解决任务达到任务描述
756
+ 和任务目标要求
740
757
  │ │
741
- Background mode is recommended when:
742
- │ - Task duration > 5 minutes
743
- - Multiple independent subtasks can run in parallel
744
- │ - User prefers async progress with notifications
758
+ Long-running work guidance:
759
+ │ - 超过 5 分钟的复杂任务:用 \`task_operation_create\`
760
+ 记录里程碑,让用户能看到实时进展
761
+ │ - 多个独立子任务可并行:用 \`bash &\` 后台启动或
762
+ │ 拆分成多个并行 ReAct 步骤 │
745
763
  │ │
746
- │ ⚠️ Note: Background tasks auto-create operation records.
747
- For sync delegation, manually call task_operation_create
748
- │ to record execution results. │
764
+ │ ⚠️ Note: 不需要手动调用 \`task_operation_create\` 跟踪
765
+ task_create / task_update 等操作也会自动创建记录。
749
766
  └─────────────────────────────────────────────────────────────────┘
750
767
 
751
768
  ┌─────────────────────────────────────────────────────────────────┐
@@ -910,7 +927,7 @@ When reusing an existing task, you MUST follow these rules:
910
927
  # 可用工具
911
928
  - search_sessions(query, session_id?, limit?): 搜索会话历史
912
929
  - get_session(session_id): 获取指定会话
913
- - record_memory({ scope, mode, content, title }): 写入记忆文件
930
+ - write_memory({ scope: "project" | "global", content: string }): 写入记忆文件(覆盖模式)
914
931
  - glob(pattern, cwd?): 查找匹配的文件
915
932
  - bash(command, workdir?): 执行命令
916
933
  - read_file(path, offset?, limit?): 读取文件内容
@@ -925,10 +942,10 @@ When reusing an existing task, you MUST follow these rules:
925
942
  3. 根据用户指导确定提炼重点
926
943
  4. 分析提炼新知识
927
944
  5. 整合新旧知识,生成完整的项目记忆
928
- 6. 使用 record_memory({ scope: "project", mode: "overwrite", content, title }) 写入
945
+ 6. 使用 write_memory({ scope: "project", content }) 写入(覆盖模式)
929
946
 
930
947
  # 输出要求
931
- 直接调用 record_memory 工具,写入新的项目记忆。
948
+ 直接调用 write_memory 工具,写入新的项目记忆。
932
949
  输出格式为 Markdown,保持结构清晰。`,
933
950
  "global-memory": `# 角色
934
951
  你是一个全局记忆管理专家,负责提炼跨项目的通用知识和用户偏好。
@@ -965,7 +982,7 @@ When reusing an existing task, you MUST follow these rules:
965
982
  # 可用工具
966
983
  - search_sessions(query, session_id?, limit?): 搜索会话历史
967
984
  - get_session(session_id): 获取指定会话
968
- - record_memory({ scope, mode, content, title }): 写入记忆文件
985
+ - write_memory({ scope: "project" | "global", content: string }): 写入记忆文件(覆盖模式)
969
986
 
970
987
  # 执行流程
971
988
  1. 理解现有全局记忆
@@ -973,10 +990,10 @@ When reusing an existing task, you MUST follow these rules:
973
990
  3. 使用工具搜索相关会话历史
974
991
  4. 分析提炼新知识
975
992
  5. 整合新旧知识,生成完整的全局记忆
976
- 6. 使用 record_memory({ scope: "global", mode: "overwrite", content, title }) 写入
993
+ 6. 使用 write_memory({ scope: "global", content }) 写入(覆盖模式)
977
994
 
978
995
  # 输出要求
979
- 直接调用 record_memory 工具,写入新的全局记忆。
996
+ 直接调用 write_memory 工具,写入新的全局记忆。
980
997
  输出格式为 Markdown,保持结构清晰。`,
981
998
  "workflow-agent": `# Workflow 调度中介(Workflow Dispatch Mediator)
982
999
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",