@ai-setting/roy-agent-core 1.5.50 → 1.5.51

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 (56) hide show
  1. package/dist/config/index.js +6 -6
  2. package/dist/env/agent/index.js +6 -6
  3. package/dist/env/commands/index.js +6 -6
  4. package/dist/env/context/index.js +2 -2
  5. package/dist/env/debug/index.js +6 -6
  6. package/dist/env/event-source/index.js +8 -8
  7. package/dist/env/hook/index.js +4 -4
  8. package/dist/env/index.js +19 -19
  9. package/dist/env/llm/index.js +6 -6
  10. package/dist/env/log-trace/index.js +6 -6
  11. package/dist/env/mcp/index.js +6 -6
  12. package/dist/env/memory/index.js +6 -6
  13. package/dist/env/plugin/index.js +6 -6
  14. package/dist/env/prompt/index.js +6 -6
  15. package/dist/env/session/index.js +6 -6
  16. package/dist/env/skill/index.js +6 -6
  17. package/dist/env/task/delegate/index.js +4 -4
  18. package/dist/env/task/index.js +8 -8
  19. package/dist/env/task/plugins/index.js +3 -3
  20. package/dist/env/task/tools/index.js +2 -2
  21. package/dist/env/tool/index.js +6 -6
  22. package/dist/env/workflow/engine/index.js +6 -6
  23. package/dist/env/workflow/index.js +9 -9
  24. package/dist/index.js +28 -28
  25. package/dist/shared/@ai-setting/{roy-agent-core-fpb999vd.js → roy-agent-core-0frwccap.js} +5 -5
  26. package/dist/shared/@ai-setting/{roy-agent-core-ezfwx334.js → roy-agent-core-0x3g6snw.js} +8 -6
  27. package/dist/shared/@ai-setting/{roy-agent-core-c7cm1wjt.js → roy-agent-core-13vzexp2.js} +1 -1
  28. package/dist/shared/@ai-setting/{roy-agent-core-9a2n122m.js → roy-agent-core-29867p67.js} +1 -1
  29. package/dist/shared/@ai-setting/{roy-agent-core-y30njf6b.js → roy-agent-core-2g5j2nw6.js} +1 -1
  30. package/dist/shared/@ai-setting/{roy-agent-core-pa9wz5q0.js → roy-agent-core-2k4r9grg.js} +4 -4
  31. package/dist/shared/@ai-setting/{roy-agent-core-hd6kd06t.js → roy-agent-core-2xah3h0z.js} +8 -3
  32. package/dist/shared/@ai-setting/{roy-agent-core-5ng0awvn.js → roy-agent-core-3jk7ngmx.js} +4 -4
  33. package/dist/shared/@ai-setting/{roy-agent-core-a8gvea2f.js → roy-agent-core-4hk6ey73.js} +17 -2
  34. package/dist/shared/@ai-setting/{roy-agent-core-8nd895aq.js → roy-agent-core-5k8watmp.js} +20 -5
  35. package/dist/shared/@ai-setting/{roy-agent-core-qfdgg56t.js → roy-agent-core-5t6cryce.js} +1 -1
  36. package/dist/shared/@ai-setting/{roy-agent-core-9sarrbw9.js → roy-agent-core-6de35s2n.js} +1 -1
  37. package/dist/shared/@ai-setting/{roy-agent-core-w65c5gac.js → roy-agent-core-88d3k0p0.js} +1 -1
  38. package/dist/shared/@ai-setting/roy-agent-core-awmae5ax.js +258 -0
  39. package/dist/shared/@ai-setting/{roy-agent-core-rjf59e7k.js → roy-agent-core-cssnkkkg.js} +2 -2
  40. package/dist/shared/@ai-setting/{roy-agent-core-pvswd18d.js → roy-agent-core-e68xspar.js} +1 -1
  41. package/dist/shared/@ai-setting/{roy-agent-core-y85xsddt.js → roy-agent-core-f336bk4g.js} +2 -2
  42. package/dist/shared/@ai-setting/{roy-agent-core-5qe84a90.js → roy-agent-core-h9tpga25.js} +3 -3
  43. package/dist/shared/@ai-setting/{roy-agent-core-yq4fv8ce.js → roy-agent-core-hd9p5490.js} +1 -1
  44. package/dist/shared/@ai-setting/{roy-agent-core-t32gmaqn.js → roy-agent-core-kjdpe2ey.js} +1 -1
  45. package/dist/shared/@ai-setting/{roy-agent-core-d8v4n80n.js → roy-agent-core-mab4mzg3.js} +1 -1
  46. package/dist/shared/@ai-setting/{roy-agent-core-vfk5mtbx.js → roy-agent-core-qjh1ec46.js} +2 -2
  47. package/dist/shared/@ai-setting/{roy-agent-core-48v06q1b.js → roy-agent-core-qmr365f5.js} +2 -2
  48. package/dist/shared/@ai-setting/{roy-agent-core-316v7cm4.js → roy-agent-core-rmndq0sb.js} +1 -1
  49. package/dist/shared/@ai-setting/{roy-agent-core-mangq9x1.js → roy-agent-core-rz57pqpa.js} +2 -2
  50. package/dist/shared/@ai-setting/{roy-agent-core-4b18eceq.js → roy-agent-core-smwwze1m.js} +4 -4
  51. package/dist/shared/@ai-setting/{roy-agent-core-s7bgrtch.js → roy-agent-core-v7583cf9.js} +12 -2
  52. package/dist/shared/@ai-setting/{roy-agent-core-m5g2jx7f.js → roy-agent-core-vehgmfj1.js} +2 -2
  53. package/dist/shared/@ai-setting/{roy-agent-core-wtnwxn8h.js → roy-agent-core-wbqmmavh.js} +4 -4
  54. package/dist/shared/@ai-setting/{roy-agent-core-sxd8snnj.js → roy-agent-core-zmw5d68q.js} +1 -1
  55. package/package.json +1 -1
  56. package/dist/shared/@ai-setting/roy-agent-core-fy1y1aqx.js +0 -248
@@ -0,0 +1,258 @@
1
+ import {
2
+ WORKFLOW_JSON_OUTPUT_PLUGIN_KEY,
3
+ init_workflow_json_output_plugin,
4
+ registerWorkflowJsonOutputPlugin,
5
+ tracedExtractStructuredJsonViaLlm
6
+ } from "./roy-agent-core-29867p67.js";
7
+ import {
8
+ AskUserError,
9
+ init_workflow_hil
10
+ } from "./roy-agent-core-e25xkv53.js";
11
+ import {
12
+ TracedAs,
13
+ init_decorator
14
+ } from "./roy-agent-core-q5qj0fes.js";
15
+ import {
16
+ __esm,
17
+ __legacyDecorateClassTS
18
+ } from "./roy-agent-core-fs0mn2jk.js";
19
+
20
+ // src/env/workflow/nodes/agent-component-adapter.ts
21
+ var AgentComponentAdapter;
22
+ var init_agent_component_adapter = __esm(() => {
23
+ init_workflow_hil();
24
+ init_workflow_json_output_plugin();
25
+ init_decorator();
26
+ AgentComponentAdapter = class AgentComponentAdapter {
27
+ agentComponent;
28
+ options;
29
+ _sessionComponent;
30
+ _llmComponent;
31
+ agentSessionPrefix = "agent";
32
+ _currentAgentSessionId;
33
+ pendingSessions = new Map;
34
+ runSessionToAgentSessions = new Map;
35
+ jsonOutputPluginRegistered = false;
36
+ constructor(agentComponent, options = {}, _sessionComponent, _llmComponent) {
37
+ this.agentComponent = agentComponent;
38
+ this.options = options;
39
+ this._sessionComponent = _sessionComponent;
40
+ this._llmComponent = _llmComponent;
41
+ this.ensureJsonOutputPluginRegistered();
42
+ }
43
+ setLLMComponent(llmComponent) {
44
+ this._llmComponent = llmComponent;
45
+ this.ensureJsonOutputPluginRegistered();
46
+ }
47
+ ensureJsonOutputPluginRegistered() {
48
+ if (this.jsonOutputPluginRegistered || !this._llmComponent) {
49
+ return;
50
+ }
51
+ registerWorkflowJsonOutputPlugin(this._llmComponent);
52
+ this.jsonOutputPluginRegistered = true;
53
+ }
54
+ setSessionComponent(sessionComponent) {
55
+ this._sessionComponent = sessionComponent;
56
+ }
57
+ getCurrentAgentSessionId() {
58
+ return this._currentAgentSessionId;
59
+ }
60
+ registerAgent(name, config) {
61
+ this.agentComponent.registerAgent(name, {
62
+ type: config.type || "general",
63
+ model: config.model,
64
+ systemPrompt: config.systemPrompt,
65
+ maxIterations: config.maxIterations,
66
+ allowedTools: config.allowedTools,
67
+ deniedTools: config.deniedTools,
68
+ timeout: config.timeout,
69
+ maxErrorRetries: config.maxErrorRetries
70
+ });
71
+ if (config.sessionIdPrefix) {
72
+ this.agentSessionPrefixes.set(name, config.sessionIdPrefix);
73
+ }
74
+ }
75
+ async run(config, resumeOptions) {
76
+ const startTime = Date.now();
77
+ const nodeId = config.nodeId || "unknown";
78
+ const runId = config.runId || "unknown";
79
+ const workflowSessionId = config.workflowSessionId;
80
+ const isResume = !!resumeOptions?.userQuery;
81
+ let agentSessionId = resumeOptions?.agentSessionId || config.agentSessionId || this._currentAgentSessionId;
82
+ if (!agentSessionId && this._sessionComponent) {
83
+ agentSessionId = `${this.agentSessionPrefix}_${runId}_${nodeId}_${Date.now()}`;
84
+ try {
85
+ await this._sessionComponent.create({
86
+ title: `Agent Session: ${config.type} (${agentSessionId})`,
87
+ metadata: {
88
+ type: "agent",
89
+ workflowRunId: runId,
90
+ workflowNodeId: nodeId
91
+ }
92
+ });
93
+ } catch (error) {
94
+ console.warn(`Failed to create agent session ${agentSessionId}:`, error);
95
+ }
96
+ }
97
+ if (agentSessionId) {
98
+ this._currentAgentSessionId = agentSessionId;
99
+ if (workflowSessionId && this._sessionComponent) {
100
+ const mapping = this.runSessionToAgentSessions.get(workflowSessionId) || [];
101
+ if (!mapping.includes(agentSessionId)) {
102
+ mapping.push(agentSessionId);
103
+ this.runSessionToAgentSessions.set(workflowSessionId, mapping);
104
+ }
105
+ }
106
+ if (isResume) {
107
+ this.pendingSessions.delete(agentSessionId);
108
+ } else {
109
+ this.pendingSessions.set(agentSessionId, {
110
+ agentSessionId,
111
+ nodeId,
112
+ runId,
113
+ createdAt: Date.now()
114
+ });
115
+ }
116
+ }
117
+ try {
118
+ const outputSchema = config.options?.outputSchema;
119
+ const context = {};
120
+ if (config.options?.timeout) {
121
+ context.abort = new AbortController;
122
+ }
123
+ if (agentSessionId) {
124
+ context.sessionId = agentSessionId;
125
+ }
126
+ if (config.options?.allowedTools) {
127
+ context.allowedTools = config.options.allowedTools;
128
+ }
129
+ if (config.options?.deniedTools) {
130
+ context.deniedTools = config.options.deniedTools;
131
+ }
132
+ context.metadata = {
133
+ runId,
134
+ nodeId,
135
+ sessionId: agentSessionId,
136
+ outputSchema
137
+ };
138
+ if (outputSchema) {
139
+ context.pluginEnabled = {
140
+ ...context.pluginEnabled ?? {},
141
+ [WORKFLOW_JSON_OUTPUT_PLUGIN_KEY]: true
142
+ };
143
+ }
144
+ if (config.workflowHistory) {
145
+ context.workflowHistory = config.workflowHistory;
146
+ }
147
+ let additionInfo = config.prompt;
148
+ let userInput = resumeOptions?.userQuery || "";
149
+ if (agentSessionId && this._sessionComponent && !isResume) {
150
+ try {
151
+ const priorMessages = await this._sessionComponent.getMessages(agentSessionId);
152
+ const hasPriorAssistant = priorMessages.some((m) => m.role === "assistant" && (Boolean(m.content?.trim()) || m.parts?.some((p) => p.type === "tool-call" || p.type === "text")));
153
+ if (hasPriorAssistant && !userInput) {
154
+ userInput = "[Workflow re-run] Inputs were updated since your last reply. Produce a new result for this run.";
155
+ }
156
+ } catch {}
157
+ }
158
+ context.additionInfo = additionInfo;
159
+ const result = await this.agentComponent.run(config.type || "general", userInput, context);
160
+ if (result.error?.startsWith("__ASK_USER_ERROR__:")) {
161
+ const jsonStr = result.error.substring("__ASK_USER_ERROR__:".length);
162
+ const errorInfo = JSON.parse(jsonStr);
163
+ throw new AskUserError(runId, errorInfo.sessionId, errorInfo.nodeId, errorInfo.nodeType || "agent", errorInfo.query);
164
+ }
165
+ const duration = Date.now() - startTime;
166
+ if (agentSessionId) {
167
+ this.pendingSessions.delete(agentSessionId);
168
+ }
169
+ const structuredOutput = await this.resolveStructuredOutput(result.structuredOutput, outputSchema, config, agentSessionId);
170
+ return {
171
+ output: structuredOutput ?? result.finalText ?? result.output,
172
+ structuredOutput,
173
+ metadata: {
174
+ duration,
175
+ iterations: result.iterations,
176
+ toolCalls: result.toolCalls?.length,
177
+ toolCallsDetail: result.toolCalls,
178
+ agentSessionId
179
+ }
180
+ };
181
+ } catch (error) {
182
+ const isAskUserError = error instanceof Error && error.name === "AskUserError";
183
+ if (isAskUserError) {
184
+ throw error;
185
+ }
186
+ const duration = Date.now() - startTime;
187
+ const errorMessage = error instanceof Error ? error.message : String(error);
188
+ if (agentSessionId) {
189
+ this.pendingSessions.delete(agentSessionId);
190
+ }
191
+ return {
192
+ output: undefined,
193
+ metadata: {
194
+ duration,
195
+ error: errorMessage,
196
+ agentSessionId
197
+ }
198
+ };
199
+ } finally {
200
+ if (isResume) {
201
+ this._currentAgentSessionId = undefined;
202
+ }
203
+ }
204
+ }
205
+ async resumeAgent(agentSessionId, userQuery, config) {
206
+ this.pendingSessions.delete(agentSessionId);
207
+ this._currentAgentSessionId = agentSessionId;
208
+ config.agentSessionId = agentSessionId;
209
+ return this.run(config, { userQuery, agentSessionId });
210
+ }
211
+ getPendingSession(agentSessionId) {
212
+ return this.pendingSessions.get(agentSessionId);
213
+ }
214
+ getPendingSessionsForRun(runId) {
215
+ return Array.from(this.pendingSessions.values()).filter((session) => session.runId === runId);
216
+ }
217
+ getAgentSessionsForWorkflowSession(workflowSessionId) {
218
+ return this.runSessionToAgentSessions.get(workflowSessionId) || [];
219
+ }
220
+ hasAgent(name) {
221
+ return this.agentComponent.getAgent(name) !== undefined;
222
+ }
223
+ listAgents() {
224
+ return this.agentComponent.listAgents().map((a) => a.name);
225
+ }
226
+ getAgentComponent() {
227
+ return this.agentComponent;
228
+ }
229
+ async resolveStructuredOutput(fromPlugin, outputSchema, config, agentSessionId) {
230
+ if (fromPlugin) {
231
+ return fromPlugin;
232
+ }
233
+ if (!outputSchema || !this._llmComponent || !agentSessionId || !this._sessionComponent) {
234
+ return;
235
+ }
236
+ try {
237
+ const sessionMessages = await this._sessionComponent.getMessages(agentSessionId);
238
+ const history = sessionMessages.map((m) => ({
239
+ role: m.role,
240
+ content: m.content ?? ""
241
+ }));
242
+ return await tracedExtractStructuredJsonViaLlm(this._llmComponent, history, outputSchema, {
243
+ model: config.options?.model,
244
+ sessionId: agentSessionId
245
+ });
246
+ } catch (error) {
247
+ console.warn("Workflow JSON extraction fallback failed:", error);
248
+ return;
249
+ }
250
+ }
251
+ agentSessionPrefixes = new Map;
252
+ };
253
+ __legacyDecorateClassTS([
254
+ TracedAs("workflow.agent_adapter.run", { recordParams: true, recordResult: true, log: true })
255
+ ], AgentComponentAdapter.prototype, "run", null);
256
+ });
257
+
258
+ export { AgentComponentAdapter, init_agent_component_adapter };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createHook
3
- } from "./roy-agent-core-yq4fv8ce.js";
3
+ } from "./roy-agent-core-hd9p5490.js";
4
4
  import {
5
5
  HookManager
6
- } from "./roy-agent-core-48v06q1b.js";
6
+ } from "./roy-agent-core-qmr365f5.js";
7
7
 
8
8
  // src/env/component.ts
9
9
  class BaseComponent {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./roy-agent-core-qxhq8ven.js";
8
8
  import {
9
9
  BaseComponent
10
- } from "./roy-agent-core-rjf59e7k.js";
10
+ } from "./roy-agent-core-cssnkkkg.js";
11
11
  import {
12
12
  __require
13
13
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -6,10 +6,10 @@ import {
6
6
  } from "./roy-agent-core-92z6t4he.js";
7
7
  import {
8
8
  init_context
9
- } from "./roy-agent-core-c7cm1wjt.js";
9
+ } from "./roy-agent-core-13vzexp2.js";
10
10
  import {
11
11
  getEnvContextOrEmpty
12
- } from "./roy-agent-core-s7bgrtch.js";
12
+ } from "./roy-agent-core-v7583cf9.js";
13
13
  import {
14
14
  TracedAs,
15
15
  init_decorator
@@ -7,14 +7,14 @@ import {
7
7
  } from "./roy-agent-core-qxhq8ven.js";
8
8
  import {
9
9
  BaseComponent
10
- } from "./roy-agent-core-rjf59e7k.js";
10
+ } from "./roy-agent-core-cssnkkkg.js";
11
11
  import {
12
12
  createHook
13
- } from "./roy-agent-core-yq4fv8ce.js";
13
+ } from "./roy-agent-core-hd9p5490.js";
14
14
  import {
15
15
  globalHookManager,
16
16
  init_global_hook_manager
17
- } from "./roy-agent-core-48v06q1b.js";
17
+ } from "./roy-agent-core-qmr365f5.js";
18
18
  import {
19
19
  createLogger,
20
20
  init_logger
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_global_hook_manager,
3
3
  init_hook_manager
4
- } from "./roy-agent-core-48v06q1b.js";
4
+ } from "./roy-agent-core-qmr365f5.js";
5
5
 
6
6
  // src/env/hook/types.ts
7
7
  function createHook(meta, fn) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-qxhq8ven.js";
5
5
  import {
6
6
  BaseComponent
7
- } from "./roy-agent-core-rjf59e7k.js";
7
+ } from "./roy-agent-core-cssnkkkg.js";
8
8
  import {
9
9
  createLogger,
10
10
  init_logger
@@ -6,7 +6,7 @@ import {
6
6
  } from "./roy-agent-core-qxhq8ven.js";
7
7
  import {
8
8
  BaseComponent
9
- } from "./roy-agent-core-rjf59e7k.js";
9
+ } from "./roy-agent-core-cssnkkkg.js";
10
10
  import {
11
11
  createLogger,
12
12
  init_logger
@@ -8,12 +8,12 @@ import {
8
8
  } from "./roy-agent-core-qxhq8ven.js";
9
9
  import {
10
10
  BaseComponent
11
- } from "./roy-agent-core-rjf59e7k.js";
11
+ } from "./roy-agent-core-cssnkkkg.js";
12
12
  import {
13
13
  LLMHookPoints,
14
14
  globalHookManager,
15
15
  init_global_hook_manager
16
- } from "./roy-agent-core-48v06q1b.js";
16
+ } from "./roy-agent-core-qmr365f5.js";
17
17
  import {
18
18
  TracedAs,
19
19
  init_decorator
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  init_context
3
- } from "./roy-agent-core-c7cm1wjt.js";
3
+ } from "./roy-agent-core-13vzexp2.js";
4
4
  import {
5
5
  getEnvContext
6
- } from "./roy-agent-core-s7bgrtch.js";
6
+ } from "./roy-agent-core-v7583cf9.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AgentComponentAdapter,
3
3
  init_agent_component_adapter
4
- } from "./roy-agent-core-fy1y1aqx.js";
4
+ } from "./roy-agent-core-awmae5ax.js";
5
5
  import {
6
6
  buildWorkflowNodeMetadata,
7
7
  getWorkflowNodeIdFromMetadata,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  BaseComponent
3
- } from "./roy-agent-core-rjf59e7k.js";
3
+ } from "./roy-agent-core-cssnkkkg.js";
4
4
  import {
5
5
  globalHookManager,
6
6
  init_global_hook_manager
7
- } from "./roy-agent-core-48v06q1b.js";
7
+ } from "./roy-agent-core-qmr365f5.js";
8
8
  import {
9
9
  createLogger,
10
10
  init_logger
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-316v7cm4.js";
9
+ } from "./roy-agent-core-rmndq0sb.js";
10
10
  import {
11
11
  WorkflowService
12
12
  } from "./roy-agent-core-4t40mkpv.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./roy-agent-core-0vbdz0x7.js";
16
16
  import {
17
17
  BaseComponent
18
- } from "./roy-agent-core-rjf59e7k.js";
18
+ } from "./roy-agent-core-cssnkkkg.js";
19
19
  import {
20
20
  createLogger,
21
21
  init_logger
@@ -136,7 +136,7 @@ class WorkflowComponent extends BaseComponent {
136
136
  const agentComponent = this._workflowEnv.getComponent("agent");
137
137
  const llmComponent = this._workflowEnv.getComponent("llm");
138
138
  if (agentComponent) {
139
- const { AgentComponentAdapter } = await import("./roy-agent-core-fpb999vd.js");
139
+ const { AgentComponentAdapter } = await import("./roy-agent-core-0frwccap.js");
140
140
  agentRunner = new AgentComponentAdapter(agentComponent, {}, this.sessionComponent, llmComponent);
141
141
  }
142
142
  }
@@ -208,7 +208,7 @@ class WorkflowComponent extends BaseComponent {
208
208
  const sessionComponent = this._workflowEnv?.getComponent("session");
209
209
  componentLogger.info(`initSqliteService - toolComponent: ${!!toolComponent}, llmComponent: ${!!llmComponent}, skillRegistry: ${!!skillComponent}, sessionComponent: ${!!sessionComponent}`);
210
210
  if (llmComponent) {
211
- const { registerWorkflowJsonOutputPlugin } = await import("./roy-agent-core-5ng0awvn.js");
211
+ const { registerWorkflowJsonOutputPlugin } = await import("./roy-agent-core-3jk7ngmx.js");
212
212
  registerWorkflowJsonOutputPlugin(llmComponent);
213
213
  }
214
214
  this.createService({
@@ -22,7 +22,7 @@ function hasEnvContext() {
22
22
  return envContextStorage.getStore() !== undefined;
23
23
  }
24
24
  function getCurrentTaskId() {
25
- return envContextStorage.getStore()?.currentTaskId;
25
+ return envContextStorage.getStore()?.agentContext?.currentTaskId;
26
26
  }
27
27
  function runWithEnvContext(context, fn) {
28
28
  if (context) {
@@ -52,6 +52,10 @@ function createEnvContext(options) {
52
52
  function mergeEnvContext(partial) {
53
53
  const current = envContextStorage.getStore();
54
54
  if (current) {
55
+ if (partial.agentContext && current.agentContext) {
56
+ Object.assign(current.agentContext, partial.agentContext);
57
+ delete partial.agentContext;
58
+ }
55
59
  Object.assign(current, partial);
56
60
  }
57
61
  }
@@ -63,7 +67,13 @@ var init_env_context = __esm(() => {
63
67
  envContextStorage = new AsyncLocalStorage;
64
68
  setCurrentTaskId = wrapFunction(function _setCurrentTaskId(taskId) {
65
69
  const prev = getCurrentTaskId();
66
- mergeEnvContext({ currentTaskId: taskId });
70
+ const ctx = envContextStorage.getStore();
71
+ if (ctx) {
72
+ if (!ctx.agentContext) {
73
+ ctx.agentContext = {};
74
+ }
75
+ ctx.agentContext.currentTaskId = taskId;
76
+ }
67
77
  logger.info(`[setCurrentTaskId] taskId=${taskId ?? "undefined"} (was: ${prev ?? "undefined"})`);
68
78
  }, "env-context.setCurrentTaskId", { recordParams: true, recordResult: false, log: true });
69
79
  });
@@ -7,11 +7,11 @@ import {
7
7
  import {
8
8
  globalHookManager,
9
9
  init_global_hook_manager
10
- } from "./roy-agent-core-48v06q1b.js";
10
+ } from "./roy-agent-core-qmr365f5.js";
11
11
  import {
12
12
  init_env_context,
13
13
  setCurrentTaskId
14
- } from "./roy-agent-core-s7bgrtch.js";
14
+ } from "./roy-agent-core-v7583cf9.js";
15
15
  import {
16
16
  TracedAs,
17
17
  init_decorator
@@ -5,7 +5,7 @@ import {
5
5
  BackgroundTaskManager,
6
6
  createDelegateTool,
7
7
  createStopTool
8
- } from "./roy-agent-core-m5g2jx7f.js";
8
+ } from "./roy-agent-core-vehgmfj1.js";
9
9
  import {
10
10
  SQLiteTaskStore,
11
11
  getDefaultTaskDbPath
@@ -17,7 +17,7 @@ import {
17
17
  getTaskTool,
18
18
  listTasksTool,
19
19
  updateTaskTool
20
- } from "./roy-agent-core-hd6kd06t.js";
20
+ } from "./roy-agent-core-2xah3h0z.js";
21
21
  import {
22
22
  createOperationTool,
23
23
  deleteOperationTool,
@@ -33,11 +33,11 @@ import {
33
33
  } from "./roy-agent-core-qxhq8ven.js";
34
34
  import {
35
35
  BaseComponent
36
- } from "./roy-agent-core-rjf59e7k.js";
36
+ } from "./roy-agent-core-cssnkkkg.js";
37
37
  import {
38
38
  globalHookManager,
39
39
  init_global_hook_manager
40
- } from "./roy-agent-core-48v06q1b.js";
40
+ } from "./roy-agent-core-qmr365f5.js";
41
41
  import {
42
42
  TracedAs,
43
43
  init_decorator
@@ -14,7 +14,7 @@ import {
14
14
  } from "./roy-agent-core-qxhq8ven.js";
15
15
  import {
16
16
  BaseComponent
17
- } from "./roy-agent-core-rjf59e7k.js";
17
+ } from "./roy-agent-core-cssnkkkg.js";
18
18
  import {
19
19
  createLogger,
20
20
  init_logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.50",
3
+ "version": "1.5.51",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",