@ai-setting/roy-agent-core 1.6.17 → 1.6.19

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 (25) hide show
  1. package/dist/env/agent/index.js +1 -1
  2. package/dist/env/event-source/index.js +3 -3
  3. package/dist/env/index.js +11 -11
  4. package/dist/env/prompt/index.js +2 -2
  5. package/dist/env/task/delegate/index.js +2 -2
  6. package/dist/env/task/index.js +4 -4
  7. package/dist/env/task/plugins/index.js +2 -2
  8. package/dist/env/task/tools/index.js +1 -1
  9. package/dist/env/workflow/engine/index.js +1 -1
  10. package/dist/env/workflow/index.js +3 -3
  11. package/dist/env/workflow/tools/index.js +1 -1
  12. package/dist/index.js +12 -12
  13. package/dist/shared/@ai-setting/{roy-agent-core-pq1q854s.js → roy-agent-core-4djnmd86.js} +45 -22
  14. package/dist/shared/@ai-setting/{roy-agent-core-cfqm5w9b.js → roy-agent-core-5ka95kh7.js} +1 -1
  15. package/dist/shared/@ai-setting/{roy-agent-core-m134hen4.js → roy-agent-core-5kc9qtej.js} +2 -2
  16. package/dist/shared/@ai-setting/{roy-agent-core-bsxgrqzq.js → roy-agent-core-8wd5awxg.js} +1 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-yqxrekhg.js → roy-agent-core-btp589bw.js} +1 -1
  18. package/dist/shared/@ai-setting/{roy-agent-core-r0t34bbh.js → roy-agent-core-c7e3htaq.js} +146 -8
  19. package/dist/shared/@ai-setting/{roy-agent-core-yr3fp8tv.js → roy-agent-core-f1cjs6c4.js} +28 -5
  20. package/dist/shared/@ai-setting/{roy-agent-core-4z7dzcgb.js → roy-agent-core-kkt2ndpf.js} +168 -7
  21. package/dist/shared/@ai-setting/{roy-agent-core-dnns0v64.js → roy-agent-core-m0wy7p0q.js} +1 -1
  22. package/dist/shared/@ai-setting/{roy-agent-core-x36fsm47.js → roy-agent-core-mekk4as5.js} +2 -2
  23. package/dist/shared/@ai-setting/{roy-agent-core-4cgkj7v0.js → roy-agent-core-mqeqevym.js} +679 -32
  24. package/dist/shared/@ai-setting/{roy-agent-core-edbhy767.js → roy-agent-core-qyb2z42s.js} +27 -1
  25. package/package.json +1 -1
@@ -102,6 +102,32 @@ function parseToolList(v) {
102
102
  }
103
103
  return;
104
104
  }
105
+ function composeToolOutputForLLM(toolName, result) {
106
+ if (!result) {
107
+ return `[ErrorType=NullResult] tool=${toolName} (no ToolResult returned by executeTool)`;
108
+ }
109
+ if (result.success) {
110
+ const out2 = result.output;
111
+ return typeof out2 === "string" ? out2 : JSON.stringify(out2 ?? "");
112
+ }
113
+ const rawError = result.error;
114
+ if (typeof rawError === "string" && rawError.length > 0) {
115
+ return rawError;
116
+ }
117
+ const meta = result.metadata ?? {};
118
+ const out = result.output;
119
+ const outRec = out && typeof out === "object" && !Array.isArray(out) ? out : {};
120
+ if (typeof outRec.error === "string" && outRec.error.length > 0) {
121
+ return outRec.error;
122
+ }
123
+ const runId = typeof meta.run_id === "string" && meta.run_id || typeof outRec.run_id === "string" && outRec.run_id || typeof outRec.session_id === "string" && outRec.session_id || "";
124
+ const status = typeof outRec.status === "string" && outRec.status || "failed";
125
+ const tag = "[ErrorType=EmptyErrorField]";
126
+ if (runId) {
127
+ return `${tag} tool=${toolName} status=${status} runId=${runId} (no error message provided by tool — query workflow_run_status for details)`;
128
+ }
129
+ return `${tag} tool=${toolName} status=${status} (no error message and no runId — tool did not surface a diagnostic)`;
130
+ }
105
131
  var logger = createLogger("agent:component");
106
132
  function toLLMMessage(msg) {
107
133
  let content;
@@ -926,7 +952,7 @@ class AgentComponent extends BaseComponent {
926
952
  this.addRemainingToolResults(hookCtx, iterAllToolCalls, iterProcessedCount + 1, "Execution aborted by plugin hook");
927
953
  break;
928
954
  }
929
- const toolOutput = toolResult.success ? toolResult.result.output || "" : toolResult.result.error || "Unknown error";
955
+ const toolOutput = composeToolOutputForLLM(toolResult.name, toolResult.result);
930
956
  const toolOutputPreview = typeof toolOutput === "string" ? toolOutput.substring(0, 50) : JSON.stringify(toolOutput).substring(0, 50);
931
957
  logger.debug(`[ReAct] Iteration ${iteration} Adding tool message: tool=${toolResult.name} output="${toolOutputPreview}..."`);
932
958
  this.pushMessage(hookCtx, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.17",
3
+ "version": "1.6.19",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",