@ai-setting/roy-agent-core 1.7.72 → 1.7.76
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.
- package/dist/env/agent/agent-component.js +6 -6
- package/dist/env/agent/agent-registry.d.ts +4 -1
- package/dist/env/agent/index.js +6 -6
- package/dist/env/error-reply.d.ts +46 -0
- package/dist/env/error-reply.js +3 -1
- package/dist/env/event-source/event-source-handlers.js +13 -12
- package/dist/env/event-source/index.js +14 -13
- package/dist/env/index.js +31 -30
- package/dist/env/llm/index.js +2 -2
- package/dist/env/llm/orphan-toolcall.d.ts +107 -0
- package/dist/env/plugin/index.js +3 -3
- package/dist/env/prompt/index.js +4 -3
- package/dist/env/prompt/prompts-index.d.ts +27 -3
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/task/backend/index.js +9 -1
- package/dist/env/task/delegate/delegate-tool.d.ts +8 -0
- package/dist/env/task/delegate/delegate-tool.js +5 -4
- package/dist/env/task/delegate/index.js +5 -4
- package/dist/env/task/hooks/contexts.d.ts +12 -1
- package/dist/env/task/hooks/task-hook-points.d.ts +8 -3
- package/dist/env/task/index.d.ts +1 -0
- package/dist/env/task/index.js +17 -7
- package/dist/env/task/mcp/index.js +3 -2
- package/dist/env/task/plugins/index.d.ts +3 -0
- package/dist/env/task/plugins/index.js +33 -9
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +61 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +6 -2
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +42 -0
- package/dist/env/task/prompt/index.js +2 -1
- package/dist/env/task/prompt/task-discipline.d.ts +9 -3
- package/dist/env/task/task-component.d.ts +79 -0
- package/dist/env/task/tools/cancel-tool.d.ts +36 -0
- package/dist/env/task/tools/completion-copy.d.ts +92 -0
- package/dist/env/task/tools/index.d.ts +2 -0
- package/dist/env/task/tools/index.js +7 -2
- package/dist/env/task/tools/pre-complete-tool.d.ts +32 -0
- package/dist/env/task/tools/task-types.d.ts +71 -17
- package/dist/env/task/types.d.ts +13 -1
- package/dist/env/tool/built-in/compact-session-tool.d.ts +120 -0
- package/dist/env/tool/built-in/index.d.ts +2 -0
- package/dist/env/tool/built-in/index.js +6 -2
- package/dist/env/tool/index.js +4 -4
- package/dist/env/workflow/engine/index.js +6 -6
- package/dist/env/workflow/index.js +15 -13
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/tools/ask-user-tool.d.ts +88 -0
- package/dist/env/workflow/tools/index.js +11 -9
- package/dist/env/workflow/tools/run-workflow.d.ts +2 -2
- package/dist/env/workflow/types/index.js +2 -2
- package/dist/env/workflow/types/workflow-hil.d.ts +25 -1
- package/dist/env/workflow/utils/index.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -33
- package/dist/shared/@ai-setting/{roy-agent-core-sm0sf6sb.js → roy-agent-core-0qyrk5k0.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-kmbct9yg.js → roy-agent-core-0snm5hc5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-yr1mryb8.js → roy-agent-core-1v4g0d4x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rxb00gjm.js → roy-agent-core-264qexac.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-2akfd64z.js +374 -0
- package/dist/shared/@ai-setting/{roy-agent-core-skyc30qx.js → roy-agent-core-3fh1f7s7.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-4rtg69cn.js +26 -0
- package/dist/shared/@ai-setting/{roy-agent-core-add1zqsh.js → roy-agent-core-6cy43nss.js} +22 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vah6g5yx.js → roy-agent-core-6rh8k6ba.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-kpg25s2q.js → roy-agent-core-8ez6mccb.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-yhwxpj12.js → roy-agent-core-9vxh6f8h.js} +233 -16
- package/dist/shared/@ai-setting/{roy-agent-core-7qvw65jt.js → roy-agent-core-aa2j7bk9.js} +11 -8
- package/dist/shared/@ai-setting/{roy-agent-core-sjr1kmfz.js → roy-agent-core-acj8ag08.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mds8tqd0.js → roy-agent-core-cgtq6427.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-34jz9mgh.js → roy-agent-core-cmprygrp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-wr7mv7k3.js → roy-agent-core-cxy143m4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pakhchy7.js → roy-agent-core-ddyk1rc0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-attpry6g.js → roy-agent-core-dqxec05w.js} +4 -3
- package/dist/shared/@ai-setting/{roy-agent-core-vm8h5zyj.js → roy-agent-core-ed233k5z.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jrj30vq3.js → roy-agent-core-er070zjq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-40rv283c.js → roy-agent-core-fghc2m8z.js} +152 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5gw0qa8m.js → roy-agent-core-ghnagzrh.js} +557 -92
- package/dist/shared/@ai-setting/{roy-agent-core-4jjwewvw.js → roy-agent-core-m46fe3x4.js} +41 -30
- package/dist/shared/@ai-setting/{roy-agent-core-e25xkv53.js → roy-agent-core-mkc3zshb.js} +3 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hfyfavp3.js → roy-agent-core-mww0mnd9.js} +231 -27
- package/dist/shared/@ai-setting/{roy-agent-core-46rv4d7d.js → roy-agent-core-nmx9934r.js} +92 -2
- package/dist/shared/@ai-setting/{roy-agent-core-1w9y7mxj.js → roy-agent-core-p3zv1mx5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jgb3bb42.js → roy-agent-core-q5r75vev.js} +17 -8
- package/dist/shared/@ai-setting/{roy-agent-core-y12kyxwa.js → roy-agent-core-t3rrb959.js} +33 -9
- package/dist/shared/@ai-setting/{roy-agent-core-dt104qa1.js → roy-agent-core-v85n42ve.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gr48c89p.js → roy-agent-core-v87njmq7.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-7sj9xs9c.js → roy-agent-core-vffccgf6.js} +252 -25
- package/dist/shared/@ai-setting/{roy-agent-core-2gzt2q8c.js → roy-agent-core-z43aj03k.js} +134 -29
- package/dist/shared/@ai-setting/roy-agent-core-zycadbpx.js +662 -0
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-1p6syv85.js +0 -1083
- 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 };
|