@ai-setting/roy-agent-core 1.7.72 → 1.7.75

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 (81) hide show
  1. package/dist/env/agent/agent-component.js +6 -6
  2. package/dist/env/agent/agent-registry.d.ts +4 -1
  3. package/dist/env/agent/index.js +6 -6
  4. package/dist/env/error-reply.d.ts +46 -0
  5. package/dist/env/error-reply.js +3 -1
  6. package/dist/env/event-source/event-source-handlers.js +12 -12
  7. package/dist/env/event-source/index.js +13 -13
  8. package/dist/env/index.js +30 -30
  9. package/dist/env/llm/index.js +2 -2
  10. package/dist/env/llm/orphan-toolcall.d.ts +107 -0
  11. package/dist/env/plugin/index.js +3 -3
  12. package/dist/env/prompt/index.js +3 -3
  13. package/dist/env/prompt/prompts-index.d.ts +24 -2
  14. package/dist/env/session/index.js +4 -4
  15. package/dist/env/session/storage/index.js +3 -3
  16. package/dist/env/task/delegate/delegate-tool.d.ts +8 -0
  17. package/dist/env/task/delegate/delegate-tool.js +4 -4
  18. package/dist/env/task/delegate/index.js +4 -4
  19. package/dist/env/task/index.js +7 -7
  20. package/dist/env/task/mcp/index.js +2 -2
  21. package/dist/env/task/plugins/index.d.ts +3 -0
  22. package/dist/env/task/plugins/index.js +32 -9
  23. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +61 -0
  24. package/dist/env/task/plugins/lark-card-patch-notifier.js +6 -2
  25. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +42 -0
  26. package/dist/env/task/prompt/index.js +1 -1
  27. package/dist/env/task/prompt/task-discipline.d.ts +9 -3
  28. package/dist/env/task/tools/cancel-tool.d.ts +28 -0
  29. package/dist/env/task/tools/index.d.ts +1 -0
  30. package/dist/env/task/tools/index.js +4 -2
  31. package/dist/env/task/tools/task-types.d.ts +22 -0
  32. package/dist/env/tool/built-in/compact-session-tool.d.ts +120 -0
  33. package/dist/env/tool/built-in/index.d.ts +2 -0
  34. package/dist/env/tool/built-in/index.js +6 -2
  35. package/dist/env/tool/index.js +4 -4
  36. package/dist/env/workflow/engine/index.js +6 -6
  37. package/dist/env/workflow/index.js +15 -13
  38. package/dist/env/workflow/plugins/index.js +2 -2
  39. package/dist/env/workflow/tools/ask-user-tool.d.ts +88 -0
  40. package/dist/env/workflow/tools/index.js +11 -9
  41. package/dist/env/workflow/tools/run-workflow.d.ts +2 -2
  42. package/dist/env/workflow/types/index.js +2 -2
  43. package/dist/env/workflow/types/workflow-hil.d.ts +25 -1
  44. package/dist/env/workflow/utils/index.js +5 -5
  45. package/dist/index.js +33 -33
  46. package/dist/shared/@ai-setting/{roy-agent-core-sm0sf6sb.js → roy-agent-core-0qyrk5k0.js} +2 -2
  47. package/dist/shared/@ai-setting/{roy-agent-core-kmbct9yg.js → roy-agent-core-0snm5hc5.js} +1 -1
  48. package/dist/shared/@ai-setting/{roy-agent-core-4jjwewvw.js → roy-agent-core-11shp00p.js} +31 -10
  49. package/dist/shared/@ai-setting/{roy-agent-core-yr1mryb8.js → roy-agent-core-1v4g0d4x.js} +1 -1
  50. package/dist/shared/@ai-setting/{roy-agent-core-rxb00gjm.js → roy-agent-core-264qexac.js} +1 -1
  51. package/dist/shared/@ai-setting/{roy-agent-core-34jz9mgh.js → roy-agent-core-29b6hc39.js} +1 -1
  52. package/dist/shared/@ai-setting/roy-agent-core-2akfd64z.js +374 -0
  53. package/dist/shared/@ai-setting/{roy-agent-core-yhwxpj12.js → roy-agent-core-3e6gg17d.js} +90 -12
  54. package/dist/shared/@ai-setting/{roy-agent-core-skyc30qx.js → roy-agent-core-3fh1f7s7.js} +2 -2
  55. package/dist/shared/@ai-setting/{roy-agent-core-2gzt2q8c.js → roy-agent-core-4gr3k7qg.js} +17 -4
  56. package/dist/shared/@ai-setting/{roy-agent-core-y12kyxwa.js → roy-agent-core-60jbrfye.js} +6 -6
  57. package/dist/shared/@ai-setting/{roy-agent-core-add1zqsh.js → roy-agent-core-6cy43nss.js} +22 -1
  58. package/dist/shared/@ai-setting/{roy-agent-core-vah6g5yx.js → roy-agent-core-6rh8k6ba.js} +5 -5
  59. package/dist/shared/@ai-setting/{roy-agent-core-kpg25s2q.js → roy-agent-core-8ez6mccb.js} +4 -2
  60. package/dist/shared/@ai-setting/{roy-agent-core-sjr1kmfz.js → roy-agent-core-acj8ag08.js} +1 -1
  61. package/dist/shared/@ai-setting/{roy-agent-core-mds8tqd0.js → roy-agent-core-cgtq6427.js} +1 -1
  62. package/dist/shared/@ai-setting/{roy-agent-core-pakhchy7.js → roy-agent-core-ddyk1rc0.js} +1 -1
  63. package/dist/shared/@ai-setting/{roy-agent-core-jgb3bb42.js → roy-agent-core-djpq6yb0.js} +16 -7
  64. package/dist/shared/@ai-setting/{roy-agent-core-attpry6g.js → roy-agent-core-dqxec05w.js} +4 -3
  65. package/dist/shared/@ai-setting/{roy-agent-core-vm8h5zyj.js → roy-agent-core-ed233k5z.js} +1 -1
  66. package/dist/shared/@ai-setting/{roy-agent-core-jrj30vq3.js → roy-agent-core-er070zjq.js} +1 -1
  67. package/dist/shared/@ai-setting/{roy-agent-core-40rv283c.js → roy-agent-core-fghc2m8z.js} +152 -2
  68. package/dist/shared/@ai-setting/{roy-agent-core-7sj9xs9c.js → roy-agent-core-hnyk1by7.js} +110 -2
  69. package/dist/shared/@ai-setting/{roy-agent-core-7qvw65jt.js → roy-agent-core-jg65qnwa.js} +11 -8
  70. package/dist/shared/@ai-setting/{roy-agent-core-e25xkv53.js → roy-agent-core-mkc3zshb.js} +3 -1
  71. package/dist/shared/@ai-setting/{roy-agent-core-hfyfavp3.js → roy-agent-core-mww0mnd9.js} +231 -27
  72. package/dist/shared/@ai-setting/{roy-agent-core-wr7mv7k3.js → roy-agent-core-n9q1encx.js} +1 -1
  73. package/dist/shared/@ai-setting/{roy-agent-core-46rv4d7d.js → roy-agent-core-nmx9934r.js} +92 -2
  74. package/dist/shared/@ai-setting/{roy-agent-core-1w9y7mxj.js → roy-agent-core-p3zv1mx5.js} +1 -1
  75. package/dist/shared/@ai-setting/roy-agent-core-snvh4s2p.js +662 -0
  76. package/dist/shared/@ai-setting/{roy-agent-core-dt104qa1.js → roy-agent-core-v85n42ve.js} +1 -1
  77. package/dist/shared/@ai-setting/{roy-agent-core-gr48c89p.js → roy-agent-core-v87njmq7.js} +3 -3
  78. package/dist/shared/@ai-setting/{roy-agent-core-5gw0qa8m.js → roy-agent-core-y7x2qzwc.js} +553 -92
  79. package/package.json +1 -1
  80. package/dist/shared/@ai-setting/roy-agent-core-1p6syv85.js +0 -1083
  81. package/dist/shared/@ai-setting/roy-agent-core-58804s3j.js +0 -155
@@ -1,155 +0,0 @@
1
- // src/env/tool/built-in/query-background-process-tool.ts
2
- import { z } from "zod";
3
- var QueryBackgroundProcessParameters = z.object({
4
- bgProcessId: z.string().min(1, "bgProcessId must not be empty").describe("The background process ID returned by delegate_task " + "(format: process_<timestamp>_<random>).")
5
- });
6
- function backgroundTaskToOutput(task) {
7
- return {
8
- alive: task.status === "pending" || task.status === "running",
9
- status: task.status,
10
- createdAt: task.createdAt,
11
- lastUpdatedAt: task.lastUpdatedAt ?? task.completedAt ?? task.startedAt ?? task.createdAt,
12
- description: task.description,
13
- ...task.result !== undefined ? { result: task.result } : {},
14
- ...task.error !== undefined ? { error: task.error } : {}
15
- };
16
- }
17
- function notFoundOutput(bgProcessId) {
18
- const now = Date.now();
19
- return {
20
- alive: false,
21
- status: "not_found",
22
- createdAt: now,
23
- lastUpdatedAt: now,
24
- description: `No background process found with id '${bgProcessId}'.`
25
- };
26
- }
27
- var queryBackgroundProcessTool = {
28
- name: "query_background_process",
29
- description: `Query the status of a background process previously launched via delegate_task.
30
-
31
- ` + `Use this tool when:
32
- ` + ` - You delegated a long-running task but have NOT received any notification after a reasonable wait (5+ minutes), and want to confirm whether the process is still alive.
33
- ` + ` - The user asks about the progress of a delegated task and you need a current snapshot.
34
- ` + ` - You suspect a delegated task got stuck (no progress messages, no completion notification).
35
-
36
- ` + `DO NOT poll this tool on every turn — it is meant for diagnostic checks at a reasonable cadence (e.g. every few minutes, or when you genuinely suspect the task is stuck).
37
-
38
- ` + `Returns a JSON object with:
39
- ` + ` - alive: boolean — true if status is 'pending' or 'running'
40
- ` + ` - status: 'pending' | 'running' | 'completed' | 'failed' | 'stopped' | 'timeout' | 'not_found'
41
- ` + ` - createdAt, lastUpdatedAt: timestamps (ms)
42
- ` + ` - description: the task description you passed to delegate_task
43
- ` + ` - result: present when status is 'completed'
44
- ` + ` - error: present when status is 'failed'
45
-
46
- ` + "Only the default receptionist agent has this tool. Sub-agents (roy, strict-task-agent, etc.) cannot see it because they do not need to query background tasks they themselves launched.",
47
- parameters: QueryBackgroundProcessParameters,
48
- permission: {
49
- level: "safe",
50
- requireConfirmation: false
51
- },
52
- metadata: {
53
- category: "task",
54
- tags: ["background", "delegate", "query", "status", "diagnostic"],
55
- version: "1.0.0",
56
- allowedAgentTypes: ["default"]
57
- },
58
- execute: async (args, ctx) => createQueryBackgroundProcessTool(null).execute(args, ctx)
59
- };
60
- function createQueryBackgroundProcessTool(manager = null) {
61
- return {
62
- name: "query_background_process",
63
- description: `Query the status of a background process previously launched via delegate_task.
64
-
65
- ` + `Use this tool when:
66
- ` + ` - You delegated a long-running task but have NOT received any notification after a reasonable wait (5+ minutes), and want to confirm whether the process is still alive.
67
- ` + ` - The user asks about the progress of a delegated task and you need a current snapshot.
68
- ` + ` - You suspect a delegated task got stuck (no progress messages, no completion notification).
69
-
70
- ` + `DO NOT poll this tool on every turn — it is meant for diagnostic checks at a reasonable cadence (e.g. every few minutes, or when you genuinely suspect the task is stuck).
71
-
72
- ` + `Returns a JSON object with:
73
- ` + ` - alive: boolean — true if status is 'pending' or 'running'
74
- ` + ` - status: 'pending' | 'running' | 'completed' | 'failed' | 'stopped' | 'timeout' | 'not_found'
75
- ` + ` - createdAt, lastUpdatedAt: timestamps (ms)
76
- ` + ` - description: the task description you passed to delegate_task
77
- ` + ` - result: present when status is 'completed'
78
- ` + ` - error: present when status is 'failed'
79
-
80
- ` + "Only the default receptionist agent has this tool. Sub-agents (roy, strict-task-agent, etc.) cannot see it because they do not need to query background tasks they themselves launched.",
81
- parameters: QueryBackgroundProcessParameters,
82
- permission: {
83
- level: "safe",
84
- requireConfirmation: false
85
- },
86
- metadata: {
87
- category: "task",
88
- tags: ["background", "delegate", "query", "status", "diagnostic"],
89
- version: "1.0.0",
90
- allowedAgentTypes: ["default"]
91
- },
92
- execute: async (args, ctx) => {
93
- const startTime = Date.now();
94
- const params = QueryBackgroundProcessParameters.parse(args);
95
- const { bgProcessId } = params;
96
- if (!manager) {
97
- return {
98
- success: false,
99
- output: "",
100
- error: "query_background_process is not initialized: no BackgroundTaskManager " + "has been bound. TaskComponent should call " + "createQueryBackgroundProcessTool(manager) and register the tool " + "during startup.",
101
- metadata: { execution_time_ms: Date.now() - startTime }
102
- };
103
- }
104
- let task;
105
- try {
106
- task = manager.getTask(bgProcessId);
107
- } catch (err) {
108
- return {
109
- success: false,
110
- output: "",
111
- error: `failed to query background task: ${err.message}`,
112
- metadata: { execution_time_ms: Date.now() - startTime }
113
- };
114
- }
115
- if (task) {
116
- const currentSessionId = ctx.session_id;
117
- if (!currentSessionId || task.parentSessionId !== currentSessionId) {
118
- return {
119
- success: true,
120
- output: JSON.stringify(notFoundOutput(bgProcessId), null, 2),
121
- metadata: {
122
- execution_time_ms: Date.now() - startTime,
123
- bgProcessId,
124
- status: "not_found",
125
- alive: false
126
- }
127
- };
128
- }
129
- }
130
- const output = task ? backgroundTaskToOutput(task) : notFoundOutput(bgProcessId);
131
- if (output.alive) {
132
- try {
133
- const activity = await manager.getSubSessionActivity?.(bgProcessId);
134
- if (activity) {
135
- output.lastUpdatedAt = Math.max(output.lastUpdatedAt, activity.updatedAt);
136
- output.messageCount = activity.messageCount;
137
- output.subSessionUpdatedAt = activity.updatedAt;
138
- }
139
- } catch {}
140
- }
141
- return {
142
- success: true,
143
- output: JSON.stringify(output, null, 2),
144
- metadata: {
145
- execution_time_ms: Date.now() - startTime,
146
- bgProcessId,
147
- status: output.status,
148
- alive: output.alive
149
- }
150
- };
151
- }
152
- };
153
- }
154
-
155
- export { queryBackgroundProcessTool, createQueryBackgroundProcessTool };