@ai-setting/roy-agent-core 1.7.62 → 1.7.64
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/config/index.js +9 -9
- package/dist/env/agent/agent-component.d.ts +33 -0
- package/dist/env/agent/agent-component.js +16 -15
- package/dist/env/agent/index.js +16 -15
- package/dist/env/agent/types.d.ts +17 -0
- package/dist/env/commands/index.js +9 -9
- package/dist/env/context/index.js +5 -5
- package/dist/env/debug/index.js +9 -9
- package/dist/env/error-reply.d.ts +53 -1
- package/dist/env/error-reply.js +10 -3
- package/dist/env/event-source/bounty-im-handler.d.ts +1 -1
- package/dist/env/event-source/cli-command-handler.js +3 -3
- package/dist/env/event-source/event-source-handlers.js +22 -21
- package/dist/env/event-source/event-store.js +4 -4
- package/dist/env/event-source/index.js +23 -22
- package/dist/env/hook/index.js +7 -7
- package/dist/env/index.js +49 -48
- package/dist/env/llm/adapter-pi-ai.d.ts +47 -0
- package/dist/env/llm/index.js +11 -10
- package/dist/env/llm/model-fallback.d.ts +54 -0
- package/dist/env/llm/redact.d.ts +39 -0
- package/dist/env/llm/types.d.ts +13 -0
- package/dist/env/log-trace/index.js +9 -9
- package/dist/env/log-trace/logger.js +2 -2
- package/dist/env/mcp/index.js +10 -10
- package/dist/env/mcp/tool/index.js +3 -3
- package/dist/env/memory/index.js +10 -10
- package/dist/env/memory/plugin/index.js +3 -3
- package/dist/env/plugin/index.js +9 -9
- package/dist/env/prompt/index.js +9 -9
- package/dist/env/session/index.js +13 -12
- package/dist/env/session/storage/index.js +7 -6
- package/dist/env/skill/index.js +9 -9
- package/dist/env/task/delegate/delegate-tool.d.ts +27 -1
- package/dist/env/task/delegate/delegate-tool.js +10 -10
- package/dist/env/task/delegate/index.js +10 -10
- package/dist/env/task/index.js +16 -16
- package/dist/env/task/mcp/index.js +5 -5
- package/dist/env/task/plugins/index.js +12 -12
- package/dist/env/task/plugins/lark-card-patch-notifier.js +4 -4
- package/dist/env/task/storage/index.js +5 -5
- package/dist/env/task/tools/index.js +5 -5
- package/dist/env/tool/built-in/index.js +5 -5
- package/dist/env/tool/index.js +12 -12
- package/dist/env/tool/types.d.ts +13 -0
- package/dist/env/workflow/engine/index.js +14 -14
- package/dist/env/workflow/hooks/index.js +9 -9
- package/dist/env/workflow/index.js +25 -24
- package/dist/env/workflow/nodes/index.js +4 -4
- package/dist/env/workflow/plugins/index.js +10 -10
- package/dist/env/workflow/service/index.js +4 -4
- package/dist/env/workflow/storage/index.js +5 -5
- package/dist/env/workflow/tools/index.js +17 -16
- package/dist/env/workflow/utils/index.js +6 -6
- package/dist/index.js +60 -59
- package/dist/shared/@ai-setting/{roy-agent-core-sj4y3wdm.js → roy-agent-core-002g6nfk.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-06jakebr.js → roy-agent-core-07fvy74y.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fr296a53.js → roy-agent-core-0cb6w0k7.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-cxpgd415.js → roy-agent-core-0ys85x46.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-6wxww10t.js → roy-agent-core-12n08pg5.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-nmn853z0.js → roy-agent-core-1h5bbqcg.js} +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-h3fwjbhp.js → roy-agent-core-37tj4y6a.js} +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-gjsvehfs.js → roy-agent-core-3wrveh5p.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-9qgrc9dy.js → roy-agent-core-40rv283c.js} +56 -16
- package/dist/shared/@ai-setting/{roy-agent-core-kvq4a4p6.js → roy-agent-core-5pr4zp88.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-qmqe8ds3.js → roy-agent-core-6j02sbee.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-hfyxv2kx.js → roy-agent-core-7cbpmk4q.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-6awgfh3x.js → roy-agent-core-7f7t9wwp.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-83bewqx8.js +10 -0
- package/dist/shared/@ai-setting/{roy-agent-core-jnszp0jq.js → roy-agent-core-85xyctnb.js} +7 -2
- package/dist/shared/@ai-setting/{roy-agent-core-2pma868e.js → roy-agent-core-87942bw4.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-ja4sr63d.js → roy-agent-core-8cx7cfdg.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-th92f833.js → roy-agent-core-9bs6xrav.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-48h4zh60.js → roy-agent-core-9bshyqjn.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-9nvyffxg.js → roy-agent-core-add1zqsh.js} +118 -8
- package/dist/shared/@ai-setting/{roy-agent-core-7tce05jt.js → roy-agent-core-ax9e9szb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8xv4qzx7.js → roy-agent-core-br9cdm8d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zjgckbdd.js → roy-agent-core-c2gbt68e.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-v7mwj8eq.js → roy-agent-core-cpcd24n2.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hczj1ryh.js → roy-agent-core-dc9zq75z.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-zy8vkbnk.js → roy-agent-core-dvtg4sn0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-cqpd41gf.js → roy-agent-core-e4hehcdr.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-hwkc0bg2.js → roy-agent-core-efkjyh69.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dfqhc9ey.js → roy-agent-core-es203w7p.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-w2ev3z5q.js → roy-agent-core-es467wsz.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-p8rf4z89.js → roy-agent-core-f77k3gqt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jw63js86.js → roy-agent-core-fttgm52a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-32ck9rqt.js → roy-agent-core-g8htfwxj.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5mrynf9g.js → roy-agent-core-gxzxq1sf.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fqandv0a.js → roy-agent-core-hjejpcg5.js} +29 -19
- package/dist/shared/@ai-setting/{roy-agent-core-2veqhrxa.js → roy-agent-core-hy3zn2q2.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-wzp4tbsn.js → roy-agent-core-jvv2h3d6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-prnry2mw.js → roy-agent-core-jz8dsypm.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-x1d6edkh.js → roy-agent-core-kmbct9yg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gc6wcd7z.js → roy-agent-core-mcy5apay.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p6a4v4fq.js → roy-agent-core-mds8tqd0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bpvz1dqr.js → roy-agent-core-mw2cen6s.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-a08dpf71.js → roy-agent-core-na18zwj0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2hkyp51n.js → roy-agent-core-nm4xbs1d.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-ntn32q7j.js +72 -0
- package/dist/shared/@ai-setting/{roy-agent-core-79gyka2q.js → roy-agent-core-nwbfepba.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-gtdtzbs7.js → roy-agent-core-pgvcf91v.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-084zthqx.js → roy-agent-core-q96qynhb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-386wa4wy.js → roy-agent-core-qq96p0tj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-33hn1beg.js → roy-agent-core-qqaak24r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vwzan9v0.js → roy-agent-core-r5wt1h3c.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-vvb4cyyy.js → roy-agent-core-rjzdj0xb.js} +11 -6
- package/dist/shared/@ai-setting/{roy-agent-core-ye4bfzqg.js → roy-agent-core-ry2eztft.js} +11 -11
- package/dist/shared/@ai-setting/{roy-agent-core-c57278kx.js → roy-agent-core-sjr1kmfz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-anb53t3v.js → roy-agent-core-tm1mxttk.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-p37kh0kt.js → roy-agent-core-v0hf14bj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-c4t4y18j.js → roy-agent-core-v6vr6za7.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-w2h6xt6k.js → roy-agent-core-vd9zak15.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-gz2jnaan.js → roy-agent-core-vncwfzw5.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-c8xvy6hj.js → roy-agent-core-w07ymg29.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-mbwaxqs0.js → roy-agent-core-xcp8vwax.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-5bj0xfjk.js → roy-agent-core-xhrrgfdy.js} +324 -43
- package/dist/shared/@ai-setting/{roy-agent-core-mkpsz128.js → roy-agent-core-xvt7kf7p.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-as0dd70m.js → roy-agent-core-xw4wsj38.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-kmvw6b4v.js → roy-agent-core-yr1mryb8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-m3w3ytxt.js → roy-agent-core-zk2jg0v7.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-mrrv80jy.js → roy-agent-core-zxz5fkwj.js} +1 -1
- package/dist/utils/temp-file-manager/index.js +3 -3
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-a6cz4d23.js +0 -10
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactSecrets
|
|
3
|
+
} from "./roy-agent-core-ntn32q7j.js";
|
|
1
4
|
import {
|
|
2
5
|
normalizeLarkAtMentions
|
|
3
6
|
} from "./roy-agent-core-m880qz3y.js";
|
|
4
7
|
import {
|
|
5
8
|
createLogger,
|
|
6
9
|
init_logger
|
|
7
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
8
11
|
|
|
9
12
|
// src/env/error-reply.ts
|
|
10
13
|
init_logger();
|
|
@@ -24,6 +27,15 @@ var UPSTREAM_RETRY_PATTERNS = [
|
|
|
24
27
|
/network error/i,
|
|
25
28
|
/overloaded/i
|
|
26
29
|
];
|
|
30
|
+
var QUOTA_EXHAUSTED_PATTERNS = [
|
|
31
|
+
/free usage limit (reached|exceeded)/i,
|
|
32
|
+
/free (model )?(usage|quota).{0,20}(limit|exhaust)/i,
|
|
33
|
+
/usage limit (reached|exceeded)/i,
|
|
34
|
+
/quota (exceeded|exhausted|reached)/i,
|
|
35
|
+
/insufficient[_ ]?(quota|balance|credit)/i,
|
|
36
|
+
/(credit|balance) (is )?(exhausted|insufficient)/i,
|
|
37
|
+
/billing (hard )?limit/i
|
|
38
|
+
];
|
|
27
39
|
var TIMEOUT_PATTERNS = [
|
|
28
40
|
/timeout/i,
|
|
29
41
|
/timed out/i,
|
|
@@ -98,6 +110,69 @@ function collectErrorText(error, depth = 0) {
|
|
|
98
110
|
return parts.join(`
|
|
99
111
|
`);
|
|
100
112
|
}
|
|
113
|
+
function extractRetryAfterSeconds(error, depth = 0) {
|
|
114
|
+
if (!error || typeof error !== "object" || depth > 6)
|
|
115
|
+
return;
|
|
116
|
+
const e = error;
|
|
117
|
+
const candidates = [
|
|
118
|
+
e.retryAfter,
|
|
119
|
+
e.retry_after,
|
|
120
|
+
e.retryAfterSeconds,
|
|
121
|
+
e.headers?.["retry-after"],
|
|
122
|
+
e.headers?.["Retry-After"],
|
|
123
|
+
e.responseHeaders?.["retry-after"],
|
|
124
|
+
e.responseHeaders?.["Retry-After"],
|
|
125
|
+
e.headers?.get?.("retry-after"),
|
|
126
|
+
e.data?.error?.retry_after,
|
|
127
|
+
e.data?.error?.retryAfter
|
|
128
|
+
];
|
|
129
|
+
for (const raw of candidates) {
|
|
130
|
+
const seconds = toSeconds(raw);
|
|
131
|
+
if (seconds !== undefined)
|
|
132
|
+
return seconds;
|
|
133
|
+
}
|
|
134
|
+
const nested = [e.lastError, e.cause];
|
|
135
|
+
if (Array.isArray(e.errors))
|
|
136
|
+
nested.push(...e.errors.slice(-2));
|
|
137
|
+
for (const inner of nested) {
|
|
138
|
+
const seconds = extractRetryAfterSeconds(inner, depth + 1);
|
|
139
|
+
if (seconds !== undefined)
|
|
140
|
+
return seconds;
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
function toSeconds(raw) {
|
|
145
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0)
|
|
146
|
+
return raw;
|
|
147
|
+
if (typeof raw !== "string")
|
|
148
|
+
return;
|
|
149
|
+
const trimmed = raw.trim();
|
|
150
|
+
if (!trimmed)
|
|
151
|
+
return;
|
|
152
|
+
const asNumber = Number(trimmed);
|
|
153
|
+
if (Number.isFinite(asNumber) && asNumber >= 0)
|
|
154
|
+
return asNumber;
|
|
155
|
+
const asDate = Date.parse(trimmed);
|
|
156
|
+
if (!Number.isNaN(asDate)) {
|
|
157
|
+
const delta = Math.max(0, asDate - Date.now());
|
|
158
|
+
return Math.round(delta / 1000);
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
function humanizeRetryAfter(seconds) {
|
|
163
|
+
if (seconds === undefined || !Number.isFinite(seconds) || seconds < 0)
|
|
164
|
+
return;
|
|
165
|
+
if (seconds < 90)
|
|
166
|
+
return "约 1 分钟内";
|
|
167
|
+
const minutes = seconds / 60;
|
|
168
|
+
if (minutes < 90)
|
|
169
|
+
return `约 ${Math.round(minutes)} 分钟后`;
|
|
170
|
+
const hours = minutes / 60;
|
|
171
|
+
if (hours < 36)
|
|
172
|
+
return `约 ${Math.round(hours)} 小时后`;
|
|
173
|
+
const days = hours / 24;
|
|
174
|
+
return `约 ${Math.round(days)} 天后`;
|
|
175
|
+
}
|
|
101
176
|
function truncate(text, max) {
|
|
102
177
|
if (text.length <= max)
|
|
103
178
|
return text;
|
|
@@ -134,6 +209,17 @@ var FAILURE_RULES = [
|
|
|
134
209
|
reason: "本次执行等待响应超时(上游长时间未返回或网络卡住)。建议稍后重试,或把任务拆小一些。",
|
|
135
210
|
retryable: true
|
|
136
211
|
},
|
|
212
|
+
{
|
|
213
|
+
id: "quota_exhausted",
|
|
214
|
+
kind: "quota_exhausted",
|
|
215
|
+
names: ["FreeUsageLimitError"],
|
|
216
|
+
patterns: QUOTA_EXHAUSTED_PATTERNS,
|
|
217
|
+
notify: true,
|
|
218
|
+
title: "模型额度已用尽",
|
|
219
|
+
reason: "本次调用被上游拒绝:该模型的额度(或免费额度)已经用完。这不是你的操作问题," + "也不是仓库代码的问题 —— 重发同一个模型不会恢复,需要换模型或等额度重置。",
|
|
220
|
+
retryable: false,
|
|
221
|
+
suggestion: "换一个模型(例如 `--model <provider>/<付费模型>`),或等额度重置后再试。"
|
|
222
|
+
},
|
|
137
223
|
{
|
|
138
224
|
id: "upstream_retry",
|
|
139
225
|
kind: "upstream_retry",
|
|
@@ -191,16 +277,20 @@ function getFailureRuleIds() {
|
|
|
191
277
|
function classifyReactFailure(error) {
|
|
192
278
|
const text = collectErrorText(error);
|
|
193
279
|
const name = error && typeof error === "object" ? String(error.name ?? "") : "";
|
|
194
|
-
const technical = text ? truncate(text.replace(/\s*\n\s*/g, " | "), 400) : undefined;
|
|
280
|
+
const technical = text ? truncate(redactSecrets(text.replace(/\s*\n\s*/g, " | ")), 400) : undefined;
|
|
195
281
|
const rule = FAILURE_RULES.find((r) => ruleMatches(r, name, text)) ?? UNKNOWN_RULE;
|
|
282
|
+
const retryAfterSeconds = rule.kind === "quota_exhausted" ? extractRetryAfterSeconds(error) : undefined;
|
|
283
|
+
const window = humanizeRetryAfter(retryAfterSeconds);
|
|
196
284
|
return {
|
|
197
285
|
kind: rule.kind,
|
|
198
286
|
ruleId: rule.id,
|
|
199
287
|
title: rule.title,
|
|
200
|
-
reason: rule.reason,
|
|
288
|
+
reason: window ? `${rule.reason}上游提示:额度${window}恢复。` : rule.reason,
|
|
201
289
|
retryable: rule.retryable,
|
|
202
290
|
notify: rule.notify,
|
|
203
|
-
technical
|
|
291
|
+
technical,
|
|
292
|
+
...retryAfterSeconds !== undefined ? { retryAfterSeconds } : {},
|
|
293
|
+
...rule.suggestion ? { suggestion: rule.suggestion } : {}
|
|
204
294
|
};
|
|
205
295
|
}
|
|
206
296
|
var MAX_QUERY_PREVIEW = 200;
|
|
@@ -214,11 +304,12 @@ function buildFailureReplyMarkdown(info, opts) {
|
|
|
214
304
|
lines.push("");
|
|
215
305
|
lines.push(`> 原始请求:${truncate(query.replace(/\s+/g, " "), MAX_QUERY_PREVIEW)}`);
|
|
216
306
|
}
|
|
217
|
-
|
|
218
|
-
|
|
307
|
+
lines.push("");
|
|
308
|
+
if (info.suggestion) {
|
|
309
|
+
lines.push(`**你可以:** ${info.suggestion}`);
|
|
310
|
+
} else if (info.retryable) {
|
|
219
311
|
lines.push("**你可以:** 直接再发一次(重发即可,无需额外操作)。");
|
|
220
312
|
} else {
|
|
221
|
-
lines.push("");
|
|
222
313
|
lines.push("**你可以:** 新开一个会话,或先让我压缩当前会话。");
|
|
223
314
|
}
|
|
224
315
|
const technical = info.technical;
|
|
@@ -229,6 +320,25 @@ function buildFailureReplyMarkdown(info, opts) {
|
|
|
229
320
|
return lines.join(`
|
|
230
321
|
`);
|
|
231
322
|
}
|
|
323
|
+
function errorName(error) {
|
|
324
|
+
if (!error || typeof error !== "object")
|
|
325
|
+
return "";
|
|
326
|
+
const n = error.name;
|
|
327
|
+
return typeof n === "string" ? n : "";
|
|
328
|
+
}
|
|
329
|
+
function formatCliFailureLine(error) {
|
|
330
|
+
const info = classifyReactFailure(error);
|
|
331
|
+
if (info.kind === "quota_exhausted") {
|
|
332
|
+
const window = humanizeRetryAfter(info.retryAfterSeconds);
|
|
333
|
+
const head = `${info.title}(${window ? window.replace(/^约 /, "约 ") + "恢复" : "恢复时间未知"})`;
|
|
334
|
+
const advice = info.suggestion ? ` 建议:${info.suggestion}` : "";
|
|
335
|
+
return `${head} —— 重发同一模型无效。${advice}`.trim();
|
|
336
|
+
}
|
|
337
|
+
const segments = (info.technical ?? "").split("|").map((seg) => seg.trim()).filter((seg) => seg.length > 0 && seg.toLowerCase() !== (errorName(error) || "").toLowerCase());
|
|
338
|
+
const informative = segments.find((seg) => /\d/.test(seg)) ?? [...segments].sort((a, b) => b.length - a.length)[0] ?? "";
|
|
339
|
+
const summary = informative.slice(0, 200);
|
|
340
|
+
return summary ? `${info.title}:${summary}` : info.title;
|
|
341
|
+
}
|
|
232
342
|
function extractReplyChannelFromEvent(envEvent) {
|
|
233
343
|
if (!envEvent || typeof envEvent !== "object")
|
|
234
344
|
return;
|
|
@@ -411,4 +521,4 @@ async function notifyReactFailure(options) {
|
|
|
411
521
|
}
|
|
412
522
|
}
|
|
413
523
|
|
|
414
|
-
export { getFailureRuleIds, classifyReactFailure, buildFailureReplyMarkdown, __resetFailureReplyDedupForTest, notifyReactFailure };
|
|
524
|
+
export { extractRetryAfterSeconds, humanizeRetryAfter, getFailureRuleIds, classifyReactFailure, buildFailureReplyMarkdown, formatCliFailureLine, __resetFailureReplyDedupForTest, notifyReactFailure };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_hook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-ax9e9szb.js";
|
|
4
4
|
import {
|
|
5
5
|
globalHookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-cpcd24n2.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_context
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-qqaak24r.js";
|
|
4
4
|
import {
|
|
5
5
|
getEnvContext
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-7cbpmk4q.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
initDatabase,
|
|
6
6
|
initializeTables,
|
|
7
7
|
resetDatabase
|
|
8
|
-
} from "./roy-agent-core-
|
|
9
|
-
import"./roy-agent-core-
|
|
8
|
+
} from "./roy-agent-core-r5wt1h3c.js";
|
|
9
|
+
import"./roy-agent-core-mcy5apay.js";
|
|
10
10
|
import"./roy-agent-core-rvxg1wps.js";
|
|
11
|
-
import"./roy-agent-core-
|
|
12
|
-
import"./roy-agent-core-
|
|
13
|
-
import"./roy-agent-core-
|
|
11
|
+
import"./roy-agent-core-qq96p0tj.js";
|
|
12
|
+
import"./roy-agent-core-7f7t9wwp.js";
|
|
13
|
+
import"./roy-agent-core-85xyctnb.js";
|
|
14
14
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
15
15
|
export {
|
|
16
16
|
resetDatabase,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
BackgroundTaskManager,
|
|
9
9
|
createDelegateTool
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-hjejpcg5.js";
|
|
11
11
|
import {
|
|
12
12
|
TaskEntityEventTypes
|
|
13
13
|
} from "./roy-agent-core-8gxth0eh.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
searchTasksTool,
|
|
23
23
|
treeTasksTool,
|
|
24
24
|
updateTaskTool
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-xw4wsj38.js";
|
|
26
26
|
import {
|
|
27
27
|
createOperationTool,
|
|
28
28
|
deleteOperationTool,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
SQLiteTaskStore,
|
|
35
35
|
getDefaultTaskDbPath
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-9bs6xrav.js";
|
|
37
37
|
import {
|
|
38
38
|
TaskHookPoints
|
|
39
39
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -42,23 +42,23 @@ import {
|
|
|
42
42
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
43
43
|
import {
|
|
44
44
|
BaseComponent
|
|
45
|
-
} from "./roy-agent-core-
|
|
45
|
+
} from "./roy-agent-core-pgvcf91v.js";
|
|
46
46
|
import {
|
|
47
47
|
globalHookManager,
|
|
48
48
|
init_global_hook_manager
|
|
49
|
-
} from "./roy-agent-core-
|
|
49
|
+
} from "./roy-agent-core-cpcd24n2.js";
|
|
50
50
|
import {
|
|
51
51
|
getEnvContextOrEmpty,
|
|
52
52
|
init_env_context
|
|
53
|
-
} from "./roy-agent-core-
|
|
53
|
+
} from "./roy-agent-core-7cbpmk4q.js";
|
|
54
54
|
import {
|
|
55
55
|
TracedAs,
|
|
56
56
|
init_decorator
|
|
57
|
-
} from "./roy-agent-core-
|
|
57
|
+
} from "./roy-agent-core-qq96p0tj.js";
|
|
58
58
|
import {
|
|
59
59
|
createLogger,
|
|
60
60
|
init_logger
|
|
61
|
-
} from "./roy-agent-core-
|
|
61
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
62
62
|
import {
|
|
63
63
|
__legacyDecorateClassTS
|
|
64
64
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
TracedAs,
|
|
11
11
|
init_decorator
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-qq96p0tj.js";
|
|
13
13
|
import {
|
|
14
14
|
createLogger,
|
|
15
15
|
init_logger
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
17
17
|
import {
|
|
18
18
|
__esm,
|
|
19
19
|
__export,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TempFileManager
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-jvv2h3d6.js";
|
|
4
4
|
import {
|
|
5
5
|
AskUserError,
|
|
6
6
|
init_workflow_hil
|
|
@@ -11,27 +11,27 @@ import {
|
|
|
11
11
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseComponent
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-pgvcf91v.js";
|
|
15
15
|
import {
|
|
16
16
|
ToolHookPoints,
|
|
17
17
|
globalHookManager,
|
|
18
18
|
init_global_hook_manager
|
|
19
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-cpcd24n2.js";
|
|
20
20
|
import {
|
|
21
21
|
getCurrentTaskId,
|
|
22
22
|
init_env_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-7cbpmk4q.js";
|
|
24
24
|
import {
|
|
25
25
|
TracedAs,
|
|
26
26
|
init_decorator,
|
|
27
27
|
init_trace_filters,
|
|
28
28
|
toolExecResultFilter,
|
|
29
29
|
toolInvokeParamFilter
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-qq96p0tj.js";
|
|
31
31
|
import {
|
|
32
32
|
createLogger,
|
|
33
33
|
init_logger
|
|
34
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
35
35
|
import {
|
|
36
36
|
__legacyDecorateClassTS,
|
|
37
37
|
__require
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseComponent
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-pgvcf91v.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
11
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
12
12
|
|
|
13
13
|
// src/env/commands/commands-component.ts
|
|
14
14
|
import path2 from "path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProcessRegistry,
|
|
3
3
|
runWithProcessRegistryAsync
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-fttgm52a.js";
|
|
5
5
|
import {
|
|
6
6
|
getSharedEventStore
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-na18zwj0.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-
|
|
16
|
+
} from "./roy-agent-core-07fvy74y.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-
|
|
23
|
+
} from "./roy-agent-core-cpcd24n2.js";
|
|
24
24
|
import {
|
|
25
25
|
init_context
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-qqaak24r.js";
|
|
27
27
|
import {
|
|
28
28
|
getCurrentTaskId,
|
|
29
29
|
getEnvContext
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-7cbpmk4q.js";
|
|
31
31
|
import {
|
|
32
32
|
TracedAs,
|
|
33
33
|
init_decorator,
|
|
34
34
|
wrapFunction
|
|
35
|
-
} from "./roy-agent-core-
|
|
35
|
+
} from "./roy-agent-core-qq96p0tj.js";
|
|
36
36
|
import {
|
|
37
37
|
createLogger,
|
|
38
38
|
init_logger
|
|
39
|
-
} from "./roy-agent-core-
|
|
39
|
+
} from "./roy-agent-core-7f7t9wwp.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 = () =>
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
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`,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionMessageConverter
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-kmbct9yg.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalizeParts
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-40rv283c.js";
|
|
7
7
|
import {
|
|
8
8
|
createLogger,
|
|
9
9
|
init_logger
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
11
11
|
import {
|
|
12
12
|
__require
|
|
13
13
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
getCurrentProcessRegistry,
|
|
9
9
|
killProcessTree
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-fttgm52a.js";
|
|
11
11
|
import {
|
|
12
12
|
init_decorator,
|
|
13
13
|
init_trace_filters,
|
|
14
14
|
toolExecResultFilter,
|
|
15
15
|
toolInvokeParamFilter,
|
|
16
16
|
wrapFunction
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-qq96p0tj.js";
|
|
18
18
|
import {
|
|
19
19
|
createLogger,
|
|
20
20
|
exports_tracer_provider,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
init_propagation,
|
|
23
23
|
init_tracer_provider,
|
|
24
24
|
propagation
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-7f7t9wwp.js";
|
|
26
26
|
import {
|
|
27
27
|
__toCommonJS
|
|
28
28
|
} from "./roy-agent-core-fs0mn2jk.js";
|