@ai-setting/roy-agent-core 1.7.61 → 1.7.63

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 (129) hide show
  1. package/dist/config/index.js +8 -8
  2. package/dist/env/agent/agent-component.d.ts +33 -0
  3. package/dist/env/agent/agent-component.js +42 -0
  4. package/dist/env/agent/index.js +19 -16
  5. package/dist/env/agent/types.d.ts +17 -0
  6. package/dist/env/commands/index.js +8 -8
  7. package/dist/env/context/index.js +4 -4
  8. package/dist/env/debug/index.js +8 -8
  9. package/dist/env/error-reply.d.ts +53 -1
  10. package/dist/env/error-reply.js +25 -0
  11. package/dist/env/event-source/cli-command-handler.js +17 -0
  12. package/dist/env/event-source/event-source-handlers.js +59 -0
  13. package/dist/env/event-source/event-store.js +18 -0
  14. package/dist/env/event-source/idempotency-key.js +20 -0
  15. package/dist/env/event-source/index.js +31 -25
  16. package/dist/env/hook/index.js +6 -6
  17. package/dist/env/index.js +53 -46
  18. package/dist/env/lark-mention-utils.js +9 -0
  19. package/dist/env/llm/adapter-pi-ai.d.ts +47 -0
  20. package/dist/env/llm/index.js +10 -9
  21. package/dist/env/llm/model-fallback.d.ts +54 -0
  22. package/dist/env/llm/redact.d.ts +39 -0
  23. package/dist/env/llm/types.d.ts +13 -0
  24. package/dist/env/log-trace/index.js +8 -8
  25. package/dist/env/log-trace/logger.js +39 -0
  26. package/dist/env/mcp/index.js +9 -9
  27. package/dist/env/mcp/tool/index.js +2 -2
  28. package/dist/env/memory/index.js +9 -9
  29. package/dist/env/memory/plugin/index.js +2 -2
  30. package/dist/env/plugin/index.js +9 -9
  31. package/dist/env/prompt/index.js +8 -8
  32. package/dist/env/session/index.js +12 -11
  33. package/dist/env/session/storage/index.js +6 -5
  34. package/dist/env/skill/index.js +8 -8
  35. package/dist/env/task/delegate/delegate-tool.d.ts +27 -1
  36. package/dist/env/task/delegate/delegate-tool.js +42 -0
  37. package/dist/env/task/delegate/index.js +13 -11
  38. package/dist/env/task/index.js +16 -15
  39. package/dist/env/task/mcp/index.js +4 -4
  40. package/dist/env/task/plugins/index.js +11 -11
  41. package/dist/env/task/plugins/lark-card-patch-notifier.js +42 -0
  42. package/dist/env/task/storage/index.js +4 -4
  43. package/dist/env/task/tools/index.js +4 -4
  44. package/dist/env/tool/built-in/index.js +4 -4
  45. package/dist/env/tool/index.js +12 -11
  46. package/dist/env/tool/types.d.ts +13 -0
  47. package/dist/env/tool/types.js +1 -0
  48. package/dist/env/workflow/engine/index.js +13 -13
  49. package/dist/env/workflow/hooks/index.js +8 -8
  50. package/dist/env/workflow/index.js +24 -23
  51. package/dist/env/workflow/nodes/index.js +3 -3
  52. package/dist/env/workflow/plugins/index.js +9 -9
  53. package/dist/env/workflow/service/index.js +3 -3
  54. package/dist/env/workflow/storage/index.js +4 -4
  55. package/dist/env/workflow/tools/index.js +16 -15
  56. package/dist/env/workflow/utils/index.js +5 -5
  57. package/dist/index.js +71 -62
  58. package/dist/shared/@ai-setting/{roy-agent-core-m2tv4pj0.js → roy-agent-core-03k5drfp.js} +212 -172
  59. package/dist/shared/@ai-setting/{roy-agent-core-dythsgkn.js → roy-agent-core-06jakebr.js} +2 -2
  60. package/dist/shared/@ai-setting/{roy-agent-core-jsn21cb9.js → roy-agent-core-084zthqx.js} +1 -1
  61. package/dist/shared/@ai-setting/{roy-agent-core-vmfk4m1v.js → roy-agent-core-1dnsk6ht.js} +3 -3
  62. package/dist/shared/@ai-setting/{roy-agent-core-5565cvw8.js → roy-agent-core-2cw72f16.js} +11 -6
  63. package/dist/shared/@ai-setting/{roy-agent-core-x1m0gs0q.js → roy-agent-core-2hkyp51n.js} +1 -1
  64. package/dist/shared/@ai-setting/{roy-agent-core-q212q0w1.js → roy-agent-core-2pma868e.js} +4 -4
  65. package/dist/shared/@ai-setting/{roy-agent-core-mw0bc9g6.js → roy-agent-core-32ck9rqt.js} +2 -2
  66. package/dist/shared/@ai-setting/{roy-agent-core-bdzdw1g3.js → roy-agent-core-33hn1beg.js} +1 -1
  67. package/dist/shared/@ai-setting/{roy-agent-core-2qkrpc7m.js → roy-agent-core-386wa4wy.js} +1 -1
  68. package/dist/shared/@ai-setting/{roy-agent-core-gtb4fj8j.js → roy-agent-core-5hq4v41q.js} +12 -10
  69. package/dist/shared/@ai-setting/{roy-agent-core-khc23qs1.js → roy-agent-core-5mrynf9g.js} +1 -1
  70. package/dist/shared/@ai-setting/{roy-agent-core-4m5spt7m.js → roy-agent-core-60f7h284.js} +5 -5
  71. package/dist/shared/@ai-setting/{roy-agent-core-y0k9kaxz.js → roy-agent-core-6awgfh3x.js} +1 -1
  72. package/dist/shared/@ai-setting/{roy-agent-core-ygfjgk9b.js → roy-agent-core-6wxww10t.js} +2 -2
  73. package/dist/shared/@ai-setting/{roy-agent-core-xc0es9zc.js → roy-agent-core-79gyka2q.js} +2 -2
  74. package/dist/shared/@ai-setting/{roy-agent-core-expvav8a.js → roy-agent-core-7tce05jt.js} +1 -1
  75. package/dist/shared/@ai-setting/{roy-agent-core-z51jktet.js → roy-agent-core-a08dpf71.js} +17 -2
  76. package/dist/shared/@ai-setting/{roy-agent-core-22r4zmkw.js → roy-agent-core-a6cz4d23.js} +3 -3
  77. package/dist/shared/@ai-setting/{roy-agent-core-0f989bnp.js → roy-agent-core-anb53t3v.js} +3 -3
  78. package/dist/shared/@ai-setting/{roy-agent-core-ymcvsdzn.js → roy-agent-core-as0dd70m.js} +2 -2
  79. package/dist/shared/@ai-setting/{roy-agent-core-jrksyqb6.js → roy-agent-core-b4zdm2n4.js} +8 -8
  80. package/dist/shared/@ai-setting/{roy-agent-core-rnzm0tpf.js → roy-agent-core-bm3gav5d.js} +4 -4
  81. package/dist/shared/@ai-setting/{roy-agent-core-nd5171pv.js → roy-agent-core-bpvz1dqr.js} +8 -8
  82. package/dist/shared/@ai-setting/{roy-agent-core-aa514zm8.js → roy-agent-core-c4t4y18j.js} +5 -5
  83. package/dist/shared/@ai-setting/{roy-agent-core-sf9tsj0g.js → roy-agent-core-c57278kx.js} +1 -1
  84. package/dist/shared/@ai-setting/{roy-agent-core-e6k448ka.js → roy-agent-core-c8xvy6hj.js} +4 -4
  85. package/dist/shared/@ai-setting/{roy-agent-core-qgapy83x.js → roy-agent-core-cxpgd415.js} +6 -6
  86. package/dist/shared/@ai-setting/{roy-agent-core-g44nbgtt.js → roy-agent-core-dfqhc9ey.js} +2 -2
  87. package/dist/shared/@ai-setting/{roy-agent-core-6cyjps72.js → roy-agent-core-ebws32tv.js} +14 -14
  88. package/dist/shared/@ai-setting/{roy-agent-core-yr5eqyhz.js → roy-agent-core-g23yp3t1.js} +309 -59
  89. package/dist/shared/@ai-setting/roy-agent-core-g6pw4esq.js +473 -0
  90. package/dist/shared/@ai-setting/{roy-agent-core-3p59ap0x.js → roy-agent-core-gc6wcd7z.js} +1 -1
  91. package/dist/shared/@ai-setting/{roy-agent-core-s7w47mnn.js → roy-agent-core-gjsvehfs.js} +1 -1
  92. package/dist/shared/@ai-setting/{roy-agent-core-cndvj1hv.js → roy-agent-core-gnt23yx0.js} +30 -118
  93. package/dist/shared/@ai-setting/{roy-agent-core-9s3payp1.js → roy-agent-core-gtdtzbs7.js} +2 -2
  94. package/dist/shared/@ai-setting/{roy-agent-core-mhppywse.js → roy-agent-core-hczj1ryh.js} +4 -4
  95. package/dist/shared/@ai-setting/{roy-agent-core-qrjs2500.js → roy-agent-core-hfyxv2kx.js} +2 -2
  96. package/dist/shared/@ai-setting/{roy-agent-core-dg286rpd.js → roy-agent-core-hwkc0bg2.js} +1 -1
  97. package/dist/shared/@ai-setting/{roy-agent-core-bc3v8pw4.js → roy-agent-core-ja4sr63d.js} +6 -6
  98. package/dist/shared/@ai-setting/roy-agent-core-jagkferh.js +16 -0
  99. package/dist/shared/@ai-setting/roy-agent-core-jm136jzh.js +99 -0
  100. package/dist/shared/@ai-setting/{roy-agent-core-g5sw19fa.js → roy-agent-core-jw63js86.js} +1 -1
  101. package/dist/shared/@ai-setting/{roy-agent-core-8fy467qs.js → roy-agent-core-kmvw6b4v.js} +1 -1
  102. package/dist/shared/@ai-setting/{roy-agent-core-3bpntd80.js → roy-agent-core-kvq4a4p6.js} +2 -2
  103. package/dist/shared/@ai-setting/{roy-agent-core-yd85623y.js → roy-agent-core-m3w3ytxt.js} +2 -2
  104. package/dist/shared/@ai-setting/{roy-agent-core-64f22h1g.js → roy-agent-core-m880qz3y.js} +7 -1
  105. package/dist/shared/@ai-setting/{roy-agent-core-5knpegzr.js → roy-agent-core-mbwaxqs0.js} +3 -3
  106. package/dist/shared/@ai-setting/{roy-agent-core-tn96n4wz.js → roy-agent-core-mkpsz128.js} +4 -4
  107. package/dist/shared/@ai-setting/{roy-agent-core-9k8ms63r.js → roy-agent-core-mrrv80jy.js} +1 -1
  108. package/dist/shared/@ai-setting/roy-agent-core-ntn32q7j.js +72 -0
  109. package/dist/shared/@ai-setting/roy-agent-core-p37kh0kt.js +155 -0
  110. package/dist/shared/@ai-setting/{roy-agent-core-60p2380d.js → roy-agent-core-p6a4v4fq.js} +1 -1
  111. package/dist/shared/@ai-setting/{roy-agent-core-hf0t8agb.js → roy-agent-core-p8rf4z89.js} +1 -1
  112. package/dist/shared/@ai-setting/roy-agent-core-pnj0zh25.js +0 -0
  113. package/dist/shared/@ai-setting/{roy-agent-core-dp1hp24k.js → roy-agent-core-prnry2mw.js} +3 -3
  114. package/dist/shared/@ai-setting/{roy-agent-core-qw5fpa24.js → roy-agent-core-qmqe8ds3.js} +3 -3
  115. package/dist/shared/@ai-setting/{roy-agent-core-jsdqzfbj.js → roy-agent-core-rfhxj8v2.js} +1 -1
  116. package/dist/shared/@ai-setting/{roy-agent-core-j0x9yf96.js → roy-agent-core-sj4y3wdm.js} +3 -3
  117. package/dist/shared/@ai-setting/{roy-agent-core-ytnedzks.js → roy-agent-core-t6nx0rsz.js} +333 -1332
  118. package/dist/shared/@ai-setting/{roy-agent-core-xeqp659x.js → roy-agent-core-th92f833.js} +2 -2
  119. package/dist/shared/@ai-setting/{roy-agent-core-ajmgyawx.js → roy-agent-core-v7mwj8eq.js} +2 -2
  120. package/dist/shared/@ai-setting/roy-agent-core-va4m04e8.js +524 -0
  121. package/dist/shared/@ai-setting/{roy-agent-core-qpqqx1wd.js → roy-agent-core-vwzan9v0.js} +2 -2
  122. package/dist/shared/@ai-setting/{roy-agent-core-pj5tfmn5.js → roy-agent-core-w2ev3z5q.js} +12 -14
  123. package/dist/shared/@ai-setting/{roy-agent-core-kfmrfaft.js → roy-agent-core-wzp4tbsn.js} +1 -1
  124. package/dist/shared/@ai-setting/{roy-agent-core-n1ck0x1r.js → roy-agent-core-ye4bfzqg.js} +11 -11
  125. package/dist/shared/@ai-setting/{roy-agent-core-p2dpcyrz.js → roy-agent-core-zjgckbdd.js} +2 -2
  126. package/dist/shared/@ai-setting/{roy-agent-core-a5nh5q6v.js → roy-agent-core-zy8vkbnk.js} +1 -1
  127. package/dist/test-utils/child-process-mock.js +23 -0
  128. package/dist/utils/temp-file-manager/index.js +2 -2
  129. package/package.json +61 -1
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ProcessRegistry,
3
3
  runWithProcessRegistryAsync
4
- } from "./roy-agent-core-g5sw19fa.js";
4
+ } from "./roy-agent-core-jw63js86.js";
5
5
  import {
6
6
  getSharedEventStore
7
- } from "./roy-agent-core-z51jktet.js";
7
+ } from "./roy-agent-core-a08dpf71.js";
8
8
  import {
9
9
  TaskHookPoints
10
10
  } from "./roy-agent-core-1pg0fepg.js";
@@ -13,30 +13,30 @@ import {
13
13
  } from "./roy-agent-core-6masakz4.js";
14
14
  import {
15
15
  DEFAULT_SUBAGENT_PROMPT
16
- } from "./roy-agent-core-dythsgkn.js";
16
+ } from "./roy-agent-core-06jakebr.js";
17
17
  import {
18
18
  runWithBgTaskIdAsync
19
19
  } from "./roy-agent-core-c1v263jn.js";
20
20
  import {
21
21
  globalHookManager,
22
22
  init_global_hook_manager
23
- } from "./roy-agent-core-ajmgyawx.js";
23
+ } from "./roy-agent-core-v7mwj8eq.js";
24
24
  import {
25
25
  init_context
26
- } from "./roy-agent-core-bdzdw1g3.js";
26
+ } from "./roy-agent-core-33hn1beg.js";
27
27
  import {
28
28
  getCurrentTaskId,
29
29
  getEnvContext
30
- } from "./roy-agent-core-qrjs2500.js";
30
+ } from "./roy-agent-core-hfyxv2kx.js";
31
31
  import {
32
32
  TracedAs,
33
33
  init_decorator,
34
34
  wrapFunction
35
- } from "./roy-agent-core-2qkrpc7m.js";
35
+ } from "./roy-agent-core-386wa4wy.js";
36
36
  import {
37
37
  createLogger,
38
38
  init_logger
39
- } from "./roy-agent-core-y0k9kaxz.js";
39
+ } from "./roy-agent-core-6awgfh3x.js";
40
40
  import {
41
41
  __legacyDecorateClassTS
42
42
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -1113,7 +1113,7 @@ class BackgroundTaskManager {
1113
1113
  return null;
1114
1114
  }
1115
1115
  async createTask(options) {
1116
- const { parentSessionId, description, prompt, subagentType, timeout, similarTaskIds, existingSubSessionId, triggerEventId } = options;
1116
+ const { parentSessionId, description, prompt, subagentType, timeout, similarTaskIds, existingSubSessionId, triggerEventId, model, fallbackModel } = options;
1117
1117
  const taskIdGen = `process_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
1118
1118
  const sessionComponent = this.getSessionComponent();
1119
1119
  if (!sessionComponent) {
@@ -1211,6 +1211,8 @@ class BackgroundTaskManager {
1211
1211
  abortController,
1212
1212
  similarTaskIds,
1213
1213
  triggerEventId,
1214
+ model,
1215
+ fallbackModel,
1214
1216
  replyChannel: replyChannelSnapshot
1215
1217
  };
1216
1218
  this.tasks.set(taskIdGen, task);
@@ -1622,13 +1624,19 @@ ${reuseSection.markdown}`;
1622
1624
  if (signal) {
1623
1625
  signal.addEventListener("abort", onAbort);
1624
1626
  }
1625
- const invokeHandleQuery = () => this.env.handle_query?.(delegateQuery, {
1626
- sessionId,
1627
- deniedTools: deniedTools.length > 0 ? deniedTools : undefined,
1628
- agentType: subagentType,
1629
- abort: signal,
1630
- runId: capturedRunId
1631
- });
1627
+ const invokeHandleQuery = () => {
1628
+ const inheritedModel = task?.model;
1629
+ const inheritedFallbackModel = task?.fallbackModel;
1630
+ return this.env.handle_query?.(delegateQuery, {
1631
+ sessionId,
1632
+ deniedTools: deniedTools.length > 0 ? deniedTools : undefined,
1633
+ agentType: subagentType,
1634
+ abort: signal,
1635
+ runId: capturedRunId,
1636
+ ...inheritedModel ? { model: inheritedModel } : {},
1637
+ ...inheritedFallbackModel ? { fallbackModel: inheritedFallbackModel } : {}
1638
+ });
1639
+ };
1632
1640
  const wrappedPromise = processRegistry ? runWithProcessRegistryAsync(processRegistry, () => runWithBgTaskIdAsync(bgTaskId, () => invokeHandleQuery())) : runWithBgTaskIdAsync(bgTaskId, () => invokeHandleQuery());
1633
1641
  wrappedPromise?.then((result) => {
1634
1642
  if (settled)
@@ -2004,7 +2012,7 @@ No need to poll — just wait for the notification and use \`task_get\` with the
2004
2012
  };
2005
2013
  await globalHookManager.execute(TaskHookPoints.DELEGATE_BEFORE, delegateCtx, { sessionId: parentSessionId });
2006
2014
  promptWithTaskInfo = delegateCtx.prompt;
2007
- return await handleBackgroundTask(backgroundTaskManager, parentSessionId, description, promptWithTaskInfo, delegateCtx.subagentType, delegateCtx.timeout, similar_task_ids, params.sub_session_id, resolvedTriggerEventId);
2015
+ return await handleBackgroundTask(backgroundTaskManager, parentSessionId, description, promptWithTaskInfo, delegateCtx.subagentType, delegateCtx.timeout, similar_task_ids, params.sub_session_id, resolvedTriggerEventId, ctx.model, ctx.fallbackModel);
2008
2016
  }
2009
2017
  };
2010
2018
  tool.execute = wrapFunction(tool.execute, "delegate.execute", {
@@ -2048,7 +2056,7 @@ function _captureReplyChannelSnapshot() {
2048
2056
  };
2049
2057
  }
2050
2058
  var captureReplyChannelSnapshot = wrapFunction(_captureReplyChannelSnapshot, "delegate.captureReplyChannel", { recordParams: false, recordResult: true, recordError: true });
2051
- async function handleBackgroundTask(backgroundTaskManager, parentSessionId, description, prompt, subagentType, timeout, similarTaskIds, existingSubSessionId, triggerEventId) {
2059
+ async function handleBackgroundTask(backgroundTaskManager, parentSessionId, description, prompt, subagentType, timeout, similarTaskIds, existingSubSessionId, triggerEventId, model, fallbackModel) {
2052
2060
  const startTime = Date.now();
2053
2061
  try {
2054
2062
  let actualSubagentType = subagentType;
@@ -2074,7 +2082,9 @@ async function handleBackgroundTask(backgroundTaskManager, parentSessionId, desc
2074
2082
  similarTaskIds,
2075
2083
  originalWorkflowName,
2076
2084
  existingSubSessionId,
2077
- triggerEventId
2085
+ triggerEventId,
2086
+ model,
2087
+ fallbackModel
2078
2088
  });
2079
2089
  const output = [
2080
2090
  `✅ Background task accepted`,
@@ -2107,102 +2117,4 @@ async function handleBackgroundTask(backgroundTaskManager, parentSessionId, desc
2107
2117
  };
2108
2118
  }
2109
2119
  }
2110
- // src/env/task/delegate/stop-tool.ts
2111
- import { z as z2 } from "zod";
2112
- var StopTaskToolParameters = z2.object({
2113
- task_id: z2.string().describe("The ID of the background task to stop")
2114
- });
2115
- var STOP_TASK_DESCRIPTION = `Stop a running background task.
2116
-
2117
- Use this tool to stop a background task that is currently running. This is useful when:
2118
- - The user wants to cancel a long-running task
2119
- - The task is taking too long and needs to be stopped
2120
- - The user wants to change direction and doesn't need the task result anymore
2121
-
2122
- When stopped, the task will be terminated immediately and you will receive a confirmation.
2123
-
2124
- Parameters:
2125
- - task_id: The ID of the background task to stop (obtained from the delegate_task response)`;
2126
- function formatDuration(ms) {
2127
- const seconds = Math.floor(ms / 1000);
2128
- const minutes = Math.floor(seconds / 60);
2129
- const hours = Math.floor(minutes / 60);
2130
- if (hours > 0) {
2131
- return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
2132
- } else if (minutes > 0) {
2133
- return `${minutes}m ${seconds % 60}s`;
2134
- } else {
2135
- return `${seconds}s`;
2136
- }
2137
- }
2138
- function createStopTool(taskManager) {
2139
- return {
2140
- name: "stop_task",
2141
- description: STOP_TASK_DESCRIPTION,
2142
- parameters: StopTaskToolParameters,
2143
- execute: async (args, ctx) => {
2144
- const startTime = Date.now();
2145
- const params = StopTaskToolParameters.parse(args);
2146
- const { task_id } = params;
2147
- const result = await taskManager.stopTask(task_id);
2148
- if (result.success) {
2149
- const task = result.task;
2150
- const elapsedMs = task.startedAt ? Date.now() - task.startedAt : Date.now() - task.createdAt;
2151
- const output = [
2152
- `✅ Task stopped successfully`,
2153
- "",
2154
- `\uD83D\uDCCB Task ID: ${task_id}`,
2155
- `\uD83D\uDCDD Description: ${task.description}`,
2156
- `\uD83D\uDD04 Status: ${task.status} → stopped`,
2157
- `⏱️ Elapsed Time: ${formatDuration(elapsedMs)}`,
2158
- "",
2159
- result.message
2160
- ].join(`
2161
- `);
2162
- return {
2163
- success: true,
2164
- output,
2165
- metadata: {
2166
- execution_time_ms: Date.now() - startTime,
2167
- task_id,
2168
- previous_status: task.status
2169
- }
2170
- };
2171
- } else {
2172
- const task = result.task;
2173
- let output;
2174
- if (task) {
2175
- output = [
2176
- `⚠️ Cannot stop task`,
2177
- "",
2178
- `\uD83D\uDCCB Task ID: ${task_id}`,
2179
- `\uD83D\uDCDD Description: ${task.description}`,
2180
- `\uD83D\uDD04 Current Status: ${task.status}`,
2181
- "",
2182
- result.message
2183
- ].join(`
2184
- `);
2185
- } else {
2186
- output = [
2187
- `❌ Task not found`,
2188
- "",
2189
- `\uD83D\uDCCB Task ID: ${task_id}`,
2190
- "",
2191
- result.message
2192
- ].join(`
2193
- `);
2194
- }
2195
- return {
2196
- success: false,
2197
- output,
2198
- error: result.message,
2199
- metadata: {
2200
- execution_time_ms: Date.now() - startTime,
2201
- task_id
2202
- }
2203
- };
2204
- }
2205
- }
2206
- };
2207
- }
2208
- export { BackgroundTaskEventTypes, BackgroundTaskManager, createDelegateTool, createStopTool };
2120
+ export { BackgroundTaskEventTypes, builtInSubAgents, getSubAgentSpec, DelegateToolParameters, buildEntryAgentPrompt, WORKFLOW_COMPAT_ALIASES, DEFAULT_TIMEOUT, BackgroundTaskManager, createDelegateTool, deriveTriggerEventIdFromEnvContext, captureReplyChannelSnapshot, handleBackgroundTask };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createHook,
3
3
  init_hook
4
- } from "./roy-agent-core-expvav8a.js";
4
+ } from "./roy-agent-core-7tce05jt.js";
5
5
  import {
6
6
  HookManager
7
- } from "./roy-agent-core-ajmgyawx.js";
7
+ } from "./roy-agent-core-v7mwj8eq.js";
8
8
 
9
9
  // src/env/component.ts
10
10
  init_hook();
@@ -5,11 +5,11 @@ import {
5
5
  initDatabase,
6
6
  initializeTables,
7
7
  resetDatabase
8
- } from "./roy-agent-core-qpqqx1wd.js";
9
- import"./roy-agent-core-3p59ap0x.js";
8
+ } from "./roy-agent-core-vwzan9v0.js";
9
+ import"./roy-agent-core-gc6wcd7z.js";
10
10
  import"./roy-agent-core-rvxg1wps.js";
11
- import"./roy-agent-core-2qkrpc7m.js";
12
- import"./roy-agent-core-y0k9kaxz.js";
11
+ import"./roy-agent-core-386wa4wy.js";
12
+ import"./roy-agent-core-6awgfh3x.js";
13
13
  import"./roy-agent-core-jnszp0jq.js";
14
14
  import"./roy-agent-core-fs0mn2jk.js";
15
15
  export {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  init_decorator,
3
3
  wrapFunction
4
- } from "./roy-agent-core-2qkrpc7m.js";
4
+ } from "./roy-agent-core-386wa4wy.js";
5
5
  import {
6
6
  createLogger,
7
7
  init_logger
8
- } from "./roy-agent-core-y0k9kaxz.js";
8
+ } from "./roy-agent-core-6awgfh3x.js";
9
9
  import {
10
10
  __esm
11
11
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TracedAs,
3
3
  init_decorator
4
- } from "./roy-agent-core-2qkrpc7m.js";
4
+ } from "./roy-agent-core-386wa4wy.js";
5
5
  import {
6
6
  __esm,
7
7
  __legacyDecorateClassTS
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentComponentAdapter,
3
3
  init_agent_component_adapter
4
- } from "./roy-agent-core-j0x9yf96.js";
4
+ } from "./roy-agent-core-sj4y3wdm.js";
5
5
  import"./roy-agent-core-1db4vpc6.js";
6
6
  import"./roy-agent-core-ze068vc9.js";
7
7
  import"./roy-agent-core-e25xkv53.js";
8
- import"./roy-agent-core-ajmgyawx.js";
9
- import"./roy-agent-core-bdzdw1g3.js";
10
- import"./roy-agent-core-qrjs2500.js";
11
- import"./roy-agent-core-2qkrpc7m.js";
12
- import"./roy-agent-core-y0k9kaxz.js";
8
+ import"./roy-agent-core-v7mwj8eq.js";
9
+ import"./roy-agent-core-33hn1beg.js";
10
+ import"./roy-agent-core-hfyxv2kx.js";
11
+ import"./roy-agent-core-386wa4wy.js";
12
+ import"./roy-agent-core-6awgfh3x.js";
13
13
  import"./roy-agent-core-jnszp0jq.js";
14
14
  import"./roy-agent-core-fs0mn2jk.js";
15
15
  init_agent_component_adapter();
@@ -0,0 +1,16 @@
1
+ // src/env/agent/summary-agent.ts
2
+ class SummaryAgent {
3
+ llmComponent;
4
+ config;
5
+ constructor(_promptComponent, llmComponent, config) {
6
+ this.llmComponent = llmComponent;
7
+ this.config = {
8
+ type: "summary",
9
+ promptName: "session/compact",
10
+ maxIterations: 1,
11
+ model: undefined,
12
+ ...config
13
+ };
14
+ }
15
+ }
16
+ export { SummaryAgent };
@@ -0,0 +1,99 @@
1
+ // src/env/task/delegate/stop-tool.ts
2
+ import { z } from "zod";
3
+ var StopTaskToolParameters = z.object({
4
+ task_id: z.string().describe("The ID of the background task to stop")
5
+ });
6
+ var STOP_TASK_DESCRIPTION = `Stop a running background task.
7
+
8
+ Use this tool to stop a background task that is currently running. This is useful when:
9
+ - The user wants to cancel a long-running task
10
+ - The task is taking too long and needs to be stopped
11
+ - The user wants to change direction and doesn't need the task result anymore
12
+
13
+ When stopped, the task will be terminated immediately and you will receive a confirmation.
14
+
15
+ Parameters:
16
+ - task_id: The ID of the background task to stop (obtained from the delegate_task response)`;
17
+ function formatDuration(ms) {
18
+ const seconds = Math.floor(ms / 1000);
19
+ const minutes = Math.floor(seconds / 60);
20
+ const hours = Math.floor(minutes / 60);
21
+ if (hours > 0) {
22
+ return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
23
+ } else if (minutes > 0) {
24
+ return `${minutes}m ${seconds % 60}s`;
25
+ } else {
26
+ return `${seconds}s`;
27
+ }
28
+ }
29
+ function createStopTool(taskManager) {
30
+ return {
31
+ name: "stop_task",
32
+ description: STOP_TASK_DESCRIPTION,
33
+ parameters: StopTaskToolParameters,
34
+ execute: async (args, ctx) => {
35
+ const startTime = Date.now();
36
+ const params = StopTaskToolParameters.parse(args);
37
+ const { task_id } = params;
38
+ const result = await taskManager.stopTask(task_id);
39
+ if (result.success) {
40
+ const task = result.task;
41
+ const elapsedMs = task.startedAt ? Date.now() - task.startedAt : Date.now() - task.createdAt;
42
+ const output = [
43
+ `✅ Task stopped successfully`,
44
+ "",
45
+ `\uD83D\uDCCB Task ID: ${task_id}`,
46
+ `\uD83D\uDCDD Description: ${task.description}`,
47
+ `\uD83D\uDD04 Status: ${task.status} → stopped`,
48
+ `⏱️ Elapsed Time: ${formatDuration(elapsedMs)}`,
49
+ "",
50
+ result.message
51
+ ].join(`
52
+ `);
53
+ return {
54
+ success: true,
55
+ output,
56
+ metadata: {
57
+ execution_time_ms: Date.now() - startTime,
58
+ task_id,
59
+ previous_status: task.status
60
+ }
61
+ };
62
+ } else {
63
+ const task = result.task;
64
+ let output;
65
+ if (task) {
66
+ output = [
67
+ `⚠️ Cannot stop task`,
68
+ "",
69
+ `\uD83D\uDCCB Task ID: ${task_id}`,
70
+ `\uD83D\uDCDD Description: ${task.description}`,
71
+ `\uD83D\uDD04 Current Status: ${task.status}`,
72
+ "",
73
+ result.message
74
+ ].join(`
75
+ `);
76
+ } else {
77
+ output = [
78
+ `❌ Task not found`,
79
+ "",
80
+ `\uD83D\uDCCB Task ID: ${task_id}`,
81
+ "",
82
+ result.message
83
+ ].join(`
84
+ `);
85
+ }
86
+ return {
87
+ success: false,
88
+ output,
89
+ error: result.message,
90
+ metadata: {
91
+ execution_time_ms: Date.now() - startTime,
92
+ task_id
93
+ }
94
+ };
95
+ }
96
+ }
97
+ };
98
+ }
99
+ export { createStopTool };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createLogger,
3
3
  init_logger
4
- } from "./roy-agent-core-y0k9kaxz.js";
4
+ } from "./roy-agent-core-6awgfh3x.js";
5
5
  import {
6
6
  __require
7
7
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DAGManager,
3
3
  init_dag_manager
4
- } from "./roy-agent-core-60p2380d.js";
4
+ } from "./roy-agent-core-p6a4v4fq.js";
5
5
 
6
6
  // src/env/workflow/utils/node-output-contracts.ts
7
7
  var VIRTUAL_OUTPUT_FIELD = "output";
@@ -6,11 +6,11 @@ import {
6
6
  } from "./roy-agent-core-7hh0brvs.js";
7
7
  import {
8
8
  BaseComponent
9
- } from "./roy-agent-core-9s3payp1.js";
9
+ } from "./roy-agent-core-gtdtzbs7.js";
10
10
  import {
11
11
  createLogger,
12
12
  init_logger
13
- } from "./roy-agent-core-y0k9kaxz.js";
13
+ } from "./roy-agent-core-6awgfh3x.js";
14
14
 
15
15
  // src/env/skill/skill-component.ts
16
16
  init_logger();
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  TracedAs,
3
3
  init_decorator
4
- } from "./roy-agent-core-2qkrpc7m.js";
4
+ } from "./roy-agent-core-386wa4wy.js";
5
5
  import {
6
6
  createLogger,
7
7
  init_logger
8
- } from "./roy-agent-core-y0k9kaxz.js";
8
+ } from "./roy-agent-core-6awgfh3x.js";
9
9
  import {
10
10
  __legacyDecorateClassTS
11
11
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -20,5 +20,11 @@ function escapeXmlAttr(value) {
20
20
  function escapeXmlText(value) {
21
21
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
22
22
  }
23
+ function countLarkMentions(content) {
24
+ if (!content)
25
+ return 0;
26
+ const matches = content.match(/<at\s+user_id\s*=\s*(?:"[^"]+"|'[^']+'|[^\s>]+)/g);
27
+ return matches ? matches.length : 0;
28
+ }
23
29
 
24
- export { normalizeLarkAtMentions };
30
+ export { normalizeLarkAtMentions, countLarkMentions };
@@ -3,11 +3,11 @@ import {
3
3
  hasDecoratorNodes,
4
4
  init_node_registry_helper,
5
5
  registerDecoratorNodeType
6
- } from "./roy-agent-core-g44nbgtt.js";
6
+ } from "./roy-agent-core-dfqhc9ey.js";
7
7
  import"./roy-agent-core-1ce3fqrk.js";
8
8
  import"./roy-agent-core-ddwa0n6h.js";
9
- import"./roy-agent-core-2qkrpc7m.js";
10
- import"./roy-agent-core-y0k9kaxz.js";
9
+ import"./roy-agent-core-386wa4wy.js";
10
+ import"./roy-agent-core-6awgfh3x.js";
11
11
  import"./roy-agent-core-jnszp0jq.js";
12
12
  import"./roy-agent-core-fs0mn2jk.js";
13
13
  init_node_registry_helper();
@@ -2,11 +2,11 @@ import {
2
2
  WorkflowRepository,
3
3
  migrateEmptyTagsToDefault,
4
4
  rowToWorkflow
5
- } from "./roy-agent-core-qpqqx1wd.js";
6
- import"./roy-agent-core-3p59ap0x.js";
5
+ } from "./roy-agent-core-vwzan9v0.js";
6
+ import"./roy-agent-core-gc6wcd7z.js";
7
7
  import"./roy-agent-core-rvxg1wps.js";
8
- import"./roy-agent-core-2qkrpc7m.js";
9
- import"./roy-agent-core-y0k9kaxz.js";
8
+ import"./roy-agent-core-386wa4wy.js";
9
+ import"./roy-agent-core-6awgfh3x.js";
10
10
  import"./roy-agent-core-jnszp0jq.js";
11
11
  import"./roy-agent-core-fs0mn2jk.js";
12
12
  export {
@@ -8,7 +8,7 @@ import {
8
8
  } from "./roy-agent-core-qxnbvgwe.js";
9
9
  import {
10
10
  BaseComponent
11
- } from "./roy-agent-core-9s3payp1.js";
11
+ } from "./roy-agent-core-gtdtzbs7.js";
12
12
  import {
13
13
  __require
14
14
  } from "./roy-agent-core-fs0mn2jk.js";
@@ -0,0 +1,72 @@
1
+ // src/env/llm/redact.ts
2
+ function redactSecrets(text, knownSecrets = []) {
3
+ let out = text;
4
+ for (const secret of knownSecrets) {
5
+ if (secret && secret.length >= 8) {
6
+ out = out.split(secret).join("<redacted>");
7
+ }
8
+ }
9
+ out = out.replace(/\boc_sk_[A-Za-z0-9_-]{8,}\b/g, "<redacted>");
10
+ out = out.replace(/\bsk-(?:proj-)?[A-Za-z0-9_-]{16,}\b/g, "<redacted>");
11
+ out = out.replace(/\bBearer\s+[A-Za-z0-9._\-+/=]{12,}\b/g, "<redacted>");
12
+ return out;
13
+ }
14
+ var CREDENTIAL_BEARING_KEYS = new Set([
15
+ "url",
16
+ "requestBodyValues",
17
+ "requestBody",
18
+ "responseBody",
19
+ "responseHeaders",
20
+ "headers"
21
+ ]);
22
+ function redactDeep(value, knownSecrets, depth = 0) {
23
+ if (depth > 4)
24
+ return value;
25
+ if (typeof value === "string")
26
+ return redactSecrets(value, knownSecrets);
27
+ if (Array.isArray(value))
28
+ return value.map((v) => redactDeep(v, knownSecrets, depth + 1));
29
+ if (value && typeof value === "object") {
30
+ const out = {};
31
+ for (const [k, v] of Object.entries(value)) {
32
+ out[k] = redactDeep(v, knownSecrets, depth + 1);
33
+ }
34
+ return out;
35
+ }
36
+ return value;
37
+ }
38
+ function redactErrorForTransport(error, knownSecrets = [], depth = 0) {
39
+ if (depth > 6)
40
+ return;
41
+ if (!error || typeof error !== "object") {
42
+ return typeof error === "string" ? redactSecrets(error, knownSecrets) : error;
43
+ }
44
+ const src = error;
45
+ const out = {};
46
+ for (const key of Object.getOwnPropertyNames(src)) {
47
+ const desc = Object.getOwnPropertyDescriptor(src, key);
48
+ if (!desc || !("value" in desc))
49
+ continue;
50
+ const value = src[key];
51
+ if (typeof value === "string") {
52
+ out[key] = redactSecrets(value, knownSecrets);
53
+ } else if (key === "cause" || key === "lastError") {
54
+ out[key] = redactErrorForTransport(value, knownSecrets, depth + 1);
55
+ } else if (key === "errors" && Array.isArray(value)) {
56
+ out[key] = value.map((inner) => redactErrorForTransport(inner, knownSecrets, depth + 1));
57
+ } else if (CREDENTIAL_BEARING_KEYS.has(key)) {
58
+ out[key] = redactDeep(value, knownSecrets);
59
+ } else {
60
+ out[key] = value;
61
+ }
62
+ }
63
+ for (const key of ["name", "message", "stack"]) {
64
+ const value = src[key];
65
+ if (typeof value === "string" && !(key in out)) {
66
+ out[key] = redactSecrets(value, knownSecrets);
67
+ }
68
+ }
69
+ return out;
70
+ }
71
+
72
+ export { redactSecrets, redactErrorForTransport };