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

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 (33) 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 +14 -13
  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 -3
  7. package/dist/env/task/plugins/index.js +2 -2
  8. package/dist/env/tool/built-in/index.js +7 -1
  9. package/dist/env/tool/index.js +3 -2
  10. package/dist/env/workflow/engine/index.js +3 -3
  11. package/dist/env/workflow/index.js +5 -5
  12. package/dist/env/workflow/nodes/index.js +1 -1
  13. package/dist/env/workflow/tools/index.js +1 -1
  14. package/dist/index.js +16 -15
  15. package/dist/shared/@ai-setting/{roy-agent-core-skfr9wjk.js → roy-agent-core-1k7z350s.js} +1 -1
  16. package/dist/shared/@ai-setting/{roy-agent-core-q79q54x2.js → roy-agent-core-2t2n1epb.js} +1 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-fzkfkd28.js → roy-agent-core-47py6rej.js} +37 -17
  18. package/dist/shared/@ai-setting/{roy-agent-core-a8pm6hya.js → roy-agent-core-6kygfd9x.js} +9 -0
  19. package/dist/shared/@ai-setting/{roy-agent-core-8cwb4fmp.js → roy-agent-core-9378eq5y.js} +139 -4
  20. package/dist/shared/@ai-setting/{roy-agent-core-vrn9qj8y.js → roy-agent-core-97x9ymda.js} +1 -1
  21. package/dist/shared/@ai-setting/roy-agent-core-amkqnyzy.js +145 -0
  22. package/dist/shared/@ai-setting/{roy-agent-core-9gde0s9d.js → roy-agent-core-ba6243hr.js} +1 -1
  23. package/dist/shared/@ai-setting/{roy-agent-core-2vhsccvz.js → roy-agent-core-caevk7xd.js} +10 -0
  24. package/dist/shared/@ai-setting/{roy-agent-core-84ex7khq.js → roy-agent-core-ekptge19.js} +3 -3
  25. package/dist/shared/@ai-setting/{roy-agent-core-8cezq5x9.js → roy-agent-core-gexpbexm.js} +1 -1
  26. package/dist/shared/@ai-setting/{roy-agent-core-415rxkzy.js → roy-agent-core-gzzvcmg3.js} +54 -20
  27. package/dist/shared/@ai-setting/{roy-agent-core-84aqc5c0.js → roy-agent-core-j25z80xr.js} +15 -1
  28. package/dist/shared/@ai-setting/{roy-agent-core-npkwftxj.js → roy-agent-core-r3209bcd.js} +5 -1
  29. package/dist/shared/@ai-setting/{roy-agent-core-mnc0hy7j.js → roy-agent-core-te3hf26b.js} +17 -6
  30. package/dist/shared/@ai-setting/{roy-agent-core-q8n1s1pb.js → roy-agent-core-vf72n6qn.js} +4 -1
  31. package/dist/shared/@ai-setting/{roy-agent-core-txk4gcwm.js → roy-agent-core-xnga0ksx.js} +9 -4
  32. package/dist/shared/@ai-setting/{roy-agent-core-57bmm0a1.js → roy-agent-core-y1m7c2v7.js} +1 -1
  33. package/package.json +1 -1
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  understandImageTool
3
3
  } from "./roy-agent-core-t7rw68q8.js";
4
+ import {
5
+ queryBackgroundProcessTool
6
+ } from "./roy-agent-core-amkqnyzy.js";
4
7
  import {
5
8
  getCurrentProcessRegistry,
6
9
  killProcessTree
@@ -929,7 +932,8 @@ function getAllBuiltInTools() {
929
932
  writeFileTool,
930
933
  editFileTool,
931
934
  grepTool,
932
- understandImageTool
935
+ understandImageTool,
936
+ queryBackgroundProcessTool
933
937
  ];
934
938
  }
935
939
  function getBuiltInTool(name) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-pzeexnhf.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-8cwb4fmp.js";
7
+ } from "./roy-agent-core-9378eq5y.js";
8
8
  import {
9
9
  DEFAULT_SUBAGENT_PROMPT
10
10
  } from "./roy-agent-core-as3phr7n.js";
@@ -349,6 +349,7 @@ class BackgroundTaskManager {
349
349
  const abortController = new AbortController;
350
350
  const processRegistry = new ProcessRegistry;
351
351
  this.processRegistries.set(taskIdGen, processRegistry);
352
+ const createdAt = Date.now();
352
353
  const task = {
353
354
  id: taskIdGen,
354
355
  subSessionId: subSession.id,
@@ -356,7 +357,8 @@ class BackgroundTaskManager {
356
357
  description,
357
358
  subagentType,
358
359
  status: "pending",
359
- createdAt: Date.now(),
360
+ createdAt,
361
+ lastUpdatedAt: createdAt,
360
362
  abortController,
361
363
  similarTaskIds
362
364
  };
@@ -384,8 +386,10 @@ class BackgroundTaskManager {
384
386
  logger.warn(`[BackgroundTaskManager] executeTask: Task not found`, { taskId });
385
387
  return;
386
388
  }
389
+ const startedAt = Date.now();
387
390
  task.status = "running";
388
- task.startedAt = Date.now();
391
+ task.startedAt = startedAt;
392
+ task.lastUpdatedAt = startedAt;
389
393
  const timeoutMs = timeout || DEFAULT_TIMEOUT;
390
394
  const abortController = this.abortControllers.get(taskId);
391
395
  this.startProgressReporter(taskId, parentSessionId || task.parentSessionId);
@@ -401,8 +405,10 @@ class BackgroundTaskManager {
401
405
  logger.info(`[BackgroundTaskManager] Task was aborted`, { taskId });
402
406
  return;
403
407
  }
408
+ const completedAt = Date.now();
404
409
  task.status = "completed";
405
- task.completedAt = Date.now();
410
+ task.completedAt = completedAt;
411
+ task.lastUpdatedAt = completedAt;
406
412
  task.result = result;
407
413
  const executionTimeMs = task.completedAt - task.startedAt;
408
414
  task.associatedTaskId = getCurrentTaskId();
@@ -431,6 +437,9 @@ class BackgroundTaskManager {
431
437
  const errorMessage = error instanceof Error ? error.message : String(error);
432
438
  const isStoppedError = errorMessage.toLowerCase().includes("stopped") || errorMessage.toLowerCase().includes("aborted");
433
439
  const executionTimeMs = task.startedAt ? Date.now() - task.startedAt : 0;
440
+ const completedAt = Date.now();
441
+ task.completedAt = completedAt;
442
+ task.lastUpdatedAt = completedAt;
434
443
  task.associatedTaskId = getCurrentTaskId();
435
444
  if (isStoppedError) {
436
445
  task.status = "stopped";
@@ -472,7 +481,6 @@ class BackgroundTaskManager {
472
481
  this.publishBackgroundEvent(BackgroundTaskEventTypes.FAILED, failedPayload, parentSessionId || task.parentSessionId);
473
482
  }
474
483
  task.error = errorMessage;
475
- task.completedAt = Date.now();
476
484
  logger.error(`[BackgroundTaskManager] Task execution error`, {
477
485
  taskId,
478
486
  status: task.status,
@@ -493,6 +501,7 @@ class BackgroundTaskManager {
493
501
  if (currentTaskId !== undefined) {
494
502
  task.associatedTaskId = currentTaskId;
495
503
  }
504
+ task.lastUpdatedAt = Date.now();
496
505
  const progressPayload = {
497
506
  backgroundTaskId: taskId,
498
507
  subSessionId: task.subSessionId,
@@ -678,9 +687,11 @@ Use these as guidance to improve task execution efficiency.`;
678
687
  message: `Cannot stop task with status: ${task.status}`
679
688
  };
680
689
  }
690
+ const completedAt = Date.now();
681
691
  task.status = "stopped";
682
692
  task.abortController?.abort();
683
- task.completedAt = Date.now();
693
+ task.completedAt = completedAt;
694
+ task.lastUpdatedAt = completedAt;
684
695
  try {
685
696
  await this.processRegistries.get(taskId)?.killAll();
686
697
  } catch (err) {
@@ -196,7 +196,7 @@ var init_agent_component_adapter = __esm(() => {
196
196
  this.agentSessionPrefixes.set(name, config.sessionIdPrefix);
197
197
  }
198
198
  }
199
- async run(config, resumeOptions) {
199
+ async run(config, resumeOptions, signal) {
200
200
  const startTime = Date.now();
201
201
  const nodeId = config.nodeId || "unknown";
202
202
  const runId = config.runId || "unknown";
@@ -248,6 +248,9 @@ var init_agent_component_adapter = __esm(() => {
248
248
  if (config.options?.timeout) {
249
249
  context.abort = new AbortController;
250
250
  }
251
+ if (signal) {
252
+ context.abort = signal;
253
+ }
251
254
  context.sessionId = agentSessionId;
252
255
  if (config.options?.allowedTools) {
253
256
  context.allowedTools = config.options.allowedTools;
@@ -620,6 +620,7 @@ var RunWorkflowInputSchema = z8.object({
620
620
  input: z8.record(z8.any()).optional().describe("Input to pass to the workflow"),
621
621
  sync: z8.boolean().default(true).describe("Wait for completion (default: true)"),
622
622
  timeout: z8.number().positive().optional().describe("Timeout in milliseconds (default: 1800000 = 30 min)"),
623
+ node_config: z8.record(z8.string(), z8.record(z8.string(), z8.any())).optional().describe("Per-node runtime config overrides keyed by node id (Task #1974). " + "Shallow-merged into each node's effective config; input wins over nodeDef.config."),
623
624
  session: z8.string().regex(/^workflow_/, { message: "session must start with 'workflow_'" }).optional().describe("Existing session ID (workflow_xxx) to resume from. Mutually exclusive with fresh `input` runs.")
624
625
  });
625
626
  function createRunWorkflowTool(workflowService) {
@@ -641,7 +642,7 @@ function createRunWorkflowTool(workflowService) {
641
642
  },
642
643
  execute: async (args, ctx) => {
643
644
  const startTime = Date.now();
644
- const { workflow_name, input, session, sync = true, timeout = 1800000 } = args;
645
+ const { workflow_name, input, session, sync = true, timeout = 1800000, node_config } = args;
645
646
  logger7.info(`Running workflow: ${workflow_name}`, {
646
647
  input,
647
648
  sync,
@@ -665,7 +666,8 @@ function createRunWorkflowTool(workflowService) {
665
666
  const baseOptions = {
666
667
  sync,
667
668
  ...parentSessionId ? { parentSessionId } : {},
668
- onSessionCreated
669
+ onSessionCreated,
670
+ ...node_config ? { nodeConfig: node_config } : {}
669
671
  };
670
672
  const executeCall = async () => {
671
673
  if (session) {
@@ -695,13 +697,16 @@ function createRunWorkflowTool(workflowService) {
695
697
  const finalRunId = capturedRunId ?? result.runId ?? "";
696
698
  if (sync) {
697
699
  return {
698
- success: result.status === "completed",
700
+ success: result.status === "completed" || result.status === "paused",
699
701
  output: {
700
702
  run_id: finalRunId,
701
703
  status: result.status,
702
704
  output: result.output,
703
705
  error: result.error,
704
- duration_ms: result.durationMs || durationMs
706
+ duration_ms: result.durationMs || durationMs,
707
+ ...result.pendingNodeId ? { pending_node_id: result.pendingNodeId } : {},
708
+ ...result.query ? { query: result.query } : {},
709
+ ...result.agentSessionId ? { agent_session_id: result.agentSessionId } : {}
705
710
  },
706
711
  metadata: {
707
712
  execution_time_ms: durationMs,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AgentComponentAdapter,
3
3
  init_agent_component_adapter
4
- } from "./roy-agent-core-q8n1s1pb.js";
4
+ } from "./roy-agent-core-vf72n6qn.js";
5
5
  import"./roy-agent-core-1db4vpc6.js";
6
6
  import"./roy-agent-core-e25xkv53.js";
7
7
  import"./roy-agent-core-gp872e7m.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",