@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.
- 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 +12 -12
- package/dist/env/event-source/index.js +13 -13
- package/dist/env/index.js +30 -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 +3 -3
- package/dist/env/prompt/prompts-index.d.ts +24 -2
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/task/delegate/delegate-tool.d.ts +8 -0
- package/dist/env/task/delegate/delegate-tool.js +4 -4
- package/dist/env/task/delegate/index.js +4 -4
- package/dist/env/task/index.js +7 -7
- package/dist/env/task/mcp/index.js +2 -2
- package/dist/env/task/plugins/index.d.ts +3 -0
- package/dist/env/task/plugins/index.js +32 -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 +1 -1
- package/dist/env/task/prompt/task-discipline.d.ts +9 -3
- package/dist/env/task/tools/cancel-tool.d.ts +28 -0
- package/dist/env/task/tools/index.d.ts +1 -0
- package/dist/env/task/tools/index.js +4 -2
- package/dist/env/task/tools/task-types.d.ts +22 -0
- 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.js +33 -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-4jjwewvw.js → roy-agent-core-11shp00p.js} +31 -10
- 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-34jz9mgh.js → roy-agent-core-29b6hc39.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-2akfd64z.js +374 -0
- package/dist/shared/@ai-setting/{roy-agent-core-yhwxpj12.js → roy-agent-core-3e6gg17d.js} +90 -12
- 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-2gzt2q8c.js → roy-agent-core-4gr3k7qg.js} +17 -4
- package/dist/shared/@ai-setting/{roy-agent-core-y12kyxwa.js → roy-agent-core-60jbrfye.js} +6 -6
- 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-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-pakhchy7.js → roy-agent-core-ddyk1rc0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jgb3bb42.js → roy-agent-core-djpq6yb0.js} +16 -7
- 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-7sj9xs9c.js → roy-agent-core-hnyk1by7.js} +110 -2
- package/dist/shared/@ai-setting/{roy-agent-core-7qvw65jt.js → roy-agent-core-jg65qnwa.js} +11 -8
- 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-wr7mv7k3.js → roy-agent-core-n9q1encx.js} +1 -1
- 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-snvh4s2p.js +662 -0
- 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-5gw0qa8m.js → roy-agent-core-y7x2qzwc.js} +553 -92
- 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
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
filterToolsByAgent,
|
|
8
8
|
parseToolList,
|
|
9
9
|
toLLMMessage
|
|
10
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
11
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-djpq6yb0.js";
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
16
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
import"../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
17
|
+
import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
23
23
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|
|
@@ -435,7 +435,10 @@ export declare class AgentRegistry {
|
|
|
435
435
|
* 设计要点:
|
|
436
436
|
* - type='sub':作为 subagent 可被 delegate_task(subagent_type="roy") 调用
|
|
437
437
|
* - systemPromptRef='roy':从 builtInPrompts['roy'] 解析(bundle-time 内置 prompt)
|
|
438
|
-
* - deniedTools=['delegate_task','stop_task']:禁止嵌套 delegation(与 general/explore 一致)
|
|
438
|
+
* - deniedTools=['delegate_task','stop_task','task_complete']:禁止嵌套 delegation(与 general/explore 一致)
|
|
439
|
+
* ★ Task #5007 — 加 task_complete:验收权移交 default agent(裁判 ≠ 运动员)。
|
|
440
|
+
* roy 只负责**执行 + 更新操作记录/进度**;进度达 100% 即视为完成并结束返回,
|
|
441
|
+
* 最终验收(task:after.complete 的 goal 检查 decision model)由 default agent 触发。
|
|
439
442
|
* - 不设 allowedTools:保留 roy 的通用工具能力
|
|
440
443
|
* - 不设 maxIterations:使用默认上限
|
|
441
444
|
*
|
package/dist/env/agent/index.js
CHANGED
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
AgentComponent,
|
|
6
6
|
AgentComponentConfigSchema
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-djpq6yb0.js";
|
|
8
|
+
import"../../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
10
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
18
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|
|
@@ -216,6 +216,52 @@ export declare function buildFailureReplyMarkdown(info: ReactFailureInfo, opts?:
|
|
|
216
216
|
export declare function formatCliFailureLine(error: unknown): string;
|
|
217
217
|
/** 测试用:清空去重状态 */
|
|
218
218
|
export declare function __resetFailureReplyDedupForTest(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Task #4983 — `ask_user` 问题的**直连投递**(无 TTY 场景专用)。
|
|
221
|
+
*
|
|
222
|
+
* ## 为什么需要独立出口(而不是复用 notifyReactFailure)
|
|
223
|
+
*
|
|
224
|
+
* `notifyReactFailure` 是**失败回执**语义:
|
|
225
|
+
* - 走 `FAILURE_RULES` 分类,`ask_user` 规则明确 `notify:false`(不发)
|
|
226
|
+
* - 走去重表(同一 triggerEvent 只回一次)
|
|
227
|
+
* - 文案是「执行失败 + 建议」
|
|
228
|
+
*
|
|
229
|
+
* 而 ask_user 要发的是「**问题 + 选项 + 答复指引**」—— 是**问用户**,不是回执。
|
|
230
|
+
* 两者语义完全不同,共用一套会互相污染(去重键会撞 / 文案会错)。
|
|
231
|
+
*
|
|
232
|
+
* ## 为什么不 spawn 在 ask_user 工具层
|
|
233
|
+
*
|
|
234
|
+
* `ask_user` 工具在 core 层,拿得到 EnvContext 的 replyChannel:
|
|
235
|
+
* - **带发送实现**(`sendMarkdown` / `reply`)→ 直接调,不 spawn lark-cli
|
|
236
|
+
* - **裸快照**(event-cascade 场景,`task.background.ask_user` 的
|
|
237
|
+
* `metadata.replyChannel` 只有 chatId/messageId/profile,没有函数)
|
|
238
|
+
* → 必须自己 spawn lark-cli 才有 delivery 能力
|
|
239
|
+
*
|
|
240
|
+
* 两条路都在这里收敛:本函数负责「裸快照 → spawn lark-cli」这一段,
|
|
241
|
+
* 复用本模块已有的 `spawnLarkReply`(已带 `--as bot` / profile / 硬超时 /
|
|
242
|
+
* @-mention 规范化,是全仓口径统一的那一支)。
|
|
243
|
+
*
|
|
244
|
+
* ## 契约
|
|
245
|
+
*
|
|
246
|
+
* - **永不抛**:投递失败只返回 `{sent:false, error}`,调用方自行决定怎么办。
|
|
247
|
+
* 理由:投递故障绝不能掩盖 `ask_user` 的原始中断语义(AskUserError)。
|
|
248
|
+
* - 有 messageId → `+messages-reply`(保持话题线索);只有 chatId → `+messages-send`。
|
|
249
|
+
*/
|
|
250
|
+
export declare function deliverAskUserMessage(options: {
|
|
251
|
+
/** 目标 chat(oc_xxx) */
|
|
252
|
+
chatId?: string;
|
|
253
|
+
/** 目标消息(om_xxx)—— 有则用 reply 保持话题线索 */
|
|
254
|
+
messageId?: string;
|
|
255
|
+
/** lark-cli profile(多 appId 场景必需,否则 99992361 open_id cross app) */
|
|
256
|
+
profile?: string;
|
|
257
|
+
/** 要投递的正文(问题 + 选项 + 指引) */
|
|
258
|
+
content: string;
|
|
259
|
+
/** 硬超时(ms),默认同失败回执 */
|
|
260
|
+
timeoutMs?: number;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
sent: boolean;
|
|
263
|
+
error?: string;
|
|
264
|
+
}>;
|
|
219
265
|
/**
|
|
220
266
|
* React 循环异常中断时,尽最大努力给飞书发一条失败说明。
|
|
221
267
|
*
|
package/dist/env/error-reply.js
CHANGED
|
@@ -2,12 +2,13 @@ import {
|
|
|
2
2
|
__resetFailureReplyDedupForTest,
|
|
3
3
|
buildFailureReplyMarkdown,
|
|
4
4
|
classifyReactFailure,
|
|
5
|
+
deliverAskUserMessage,
|
|
5
6
|
extractRetryAfterSeconds,
|
|
6
7
|
formatCliFailureLine,
|
|
7
8
|
getFailureRuleIds,
|
|
8
9
|
humanizeRetryAfter,
|
|
9
10
|
notifyReactFailure
|
|
10
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
} from "../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
11
12
|
import"../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
12
13
|
import"../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
13
14
|
import"../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
@@ -19,6 +20,7 @@ export {
|
|
|
19
20
|
getFailureRuleIds,
|
|
20
21
|
formatCliFailureLine,
|
|
21
22
|
extractRetryAfterSeconds,
|
|
23
|
+
deliverAskUserMessage,
|
|
22
24
|
classifyReactFailure,
|
|
23
25
|
buildFailureReplyMarkdown,
|
|
24
26
|
__resetFailureReplyDedupForTest
|
|
@@ -11,31 +11,31 @@ import {
|
|
|
11
11
|
patchCardByLarkCli,
|
|
12
12
|
renderRuleNoticeSection,
|
|
13
13
|
timerHandler
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "../../shared/@ai-setting/roy-agent-core-60jbrfye.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
16
|
-
import"../../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
17
16
|
import {
|
|
18
17
|
cliCommandHandler
|
|
19
18
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
20
19
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
20
|
+
import"../../shared/@ai-setting/roy-agent-core-y7x2qzwc.js";
|
|
22
21
|
import"../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
22
|
+
import"../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
24
23
|
import"../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
25
24
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
26
25
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
27
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
28
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
29
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
26
|
+
import"../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
27
|
+
import"../../shared/@ai-setting/roy-agent-core-p3zv1mx5.js";
|
|
28
|
+
import"../../shared/@ai-setting/roy-agent-core-nmx9934r.js";
|
|
29
|
+
import"../../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
30
30
|
import"../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
31
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
32
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
33
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
31
|
+
import"../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
32
|
+
import"../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
33
|
+
import"../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
34
34
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
35
35
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
36
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
37
|
-
import"../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
36
|
+
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
38
37
|
import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
38
|
+
import"../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
39
39
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
40
40
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|
|
41
41
|
import"../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import"../../shared/@ai-setting/roy-agent-core-b4x6x4k2.js";
|
|
2
2
|
import {
|
|
3
3
|
EventSourceComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-n9q1encx.js";
|
|
5
5
|
import {
|
|
6
6
|
BountyIMInstance,
|
|
7
7
|
COMMAND_PREFIX,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
timerHandler,
|
|
34
34
|
translateCardActionToCommand,
|
|
35
35
|
writeFallbackModelList
|
|
36
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
36
|
+
} from "../../shared/@ai-setting/roy-agent-core-60jbrfye.js";
|
|
37
37
|
import {
|
|
38
38
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
39
39
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
isValidEventSourceType,
|
|
44
44
|
validateEventSourceConfig
|
|
45
45
|
} from "../../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
46
|
-
import"../../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
47
46
|
import {
|
|
48
47
|
CLI_COMMAND_ES_TYPE,
|
|
49
48
|
CLI_SESSION_CHAT_ID_PREFIX,
|
|
@@ -52,29 +51,30 @@ import {
|
|
|
52
51
|
parseCliSessionChatId
|
|
53
52
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
54
53
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
55
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
54
|
+
import"../../shared/@ai-setting/roy-agent-core-y7x2qzwc.js";
|
|
56
55
|
import {
|
|
57
56
|
EventStoreImpl,
|
|
58
57
|
getSharedEventStore,
|
|
59
58
|
resetSharedEventStore,
|
|
60
59
|
setSharedEventStore
|
|
61
60
|
} from "../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
62
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
61
|
+
import"../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
63
62
|
import"../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
64
63
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
65
64
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
66
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
67
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
68
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
65
|
+
import"../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
66
|
+
import"../../shared/@ai-setting/roy-agent-core-p3zv1mx5.js";
|
|
67
|
+
import"../../shared/@ai-setting/roy-agent-core-nmx9934r.js";
|
|
68
|
+
import"../../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
69
69
|
import"../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
70
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
71
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
72
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
70
|
+
import"../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
71
|
+
import"../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
72
|
+
import"../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
73
73
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
74
74
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
75
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
76
|
-
import"../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
75
|
+
import"../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
77
76
|
import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
77
|
+
import"../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
78
78
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
79
79
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|
|
80
80
|
import"../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
|
package/dist/env/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-snvh4s2p.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskComponent
|
|
6
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../shared/@ai-setting/roy-agent-core-4gr3k7qg.js";
|
|
7
|
+
import"../shared/@ai-setting/roy-agent-core-2akfd64z.js";
|
|
8
8
|
import"../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
9
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
import"../shared/@ai-setting/roy-agent-core-jg65qnwa.js";
|
|
10
10
|
import"../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
11
11
|
import"../shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
|
|
12
12
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
13
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
|
|
14
14
|
import"../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
15
15
|
import {
|
|
16
16
|
EventSourceComponent
|
|
17
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../shared/@ai-setting/roy-agent-core-n9q1encx.js";
|
|
18
18
|
import {
|
|
19
19
|
builtInHandlers,
|
|
20
20
|
larkCliHandler
|
|
21
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
} from "../shared/@ai-setting/roy-agent-core-60jbrfye.js";
|
|
22
22
|
import {
|
|
23
23
|
EventSourceInitHooks,
|
|
24
24
|
getDefaultConfigForType,
|
|
@@ -26,68 +26,68 @@ import {
|
|
|
26
26
|
isValidEventSourceType,
|
|
27
27
|
validateEventSourceConfig
|
|
28
28
|
} from "../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
29
|
-
import"../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
30
29
|
import"../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
31
30
|
import"../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
32
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
31
|
+
import"../shared/@ai-setting/roy-agent-core-y7x2qzwc.js";
|
|
33
32
|
import"../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
33
|
+
import"../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
35
34
|
import"../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
36
35
|
import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
37
36
|
import"../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
38
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
39
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
40
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
37
|
+
import"../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
38
|
+
import"../shared/@ai-setting/roy-agent-core-p3zv1mx5.js";
|
|
39
|
+
import"../shared/@ai-setting/roy-agent-core-nmx9934r.js";
|
|
41
40
|
import {
|
|
42
41
|
WorkflowComponent
|
|
43
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
42
|
+
} from "../shared/@ai-setting/roy-agent-core-v87njmq7.js";
|
|
44
43
|
import"../shared/@ai-setting/roy-agent-core-es203w7p.js";
|
|
45
44
|
import"../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
46
45
|
import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
47
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
48
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
49
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
46
|
+
import"../shared/@ai-setting/roy-agent-core-mww0mnd9.js";
|
|
47
|
+
import"../shared/@ai-setting/roy-agent-core-ddyk1rc0.js";
|
|
48
|
+
import"../shared/@ai-setting/roy-agent-core-0qyrk5k0.js";
|
|
50
49
|
import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
51
50
|
import"../shared/@ai-setting/roy-agent-core-12n08pg5.js";
|
|
52
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
51
|
+
import"../shared/@ai-setting/roy-agent-core-6cy43nss.js";
|
|
52
|
+
import"../shared/@ai-setting/roy-agent-core-6rh8k6ba.js";
|
|
53
53
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
54
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
54
|
+
import"../shared/@ai-setting/roy-agent-core-dqxec05w.js";
|
|
55
55
|
import"../shared/@ai-setting/roy-agent-core-efkjyh69.js";
|
|
56
56
|
import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
57
57
|
import"../shared/@ai-setting/roy-agent-core-dvtg4sn0.js";
|
|
58
58
|
import"../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
59
59
|
import"../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
60
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
61
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
60
|
+
import"../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
61
|
+
import"../shared/@ai-setting/roy-agent-core-acj8ag08.js";
|
|
62
62
|
import"../shared/@ai-setting/roy-agent-core-ddwa0n6h.js";
|
|
63
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
64
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
63
|
+
import"../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
64
|
+
import"../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
65
65
|
import"../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
66
66
|
import"../shared/@ai-setting/roy-agent-core-jagkferh.js";
|
|
67
67
|
import {
|
|
68
68
|
AgentComponent,
|
|
69
69
|
AgentComponentConfigSchema
|
|
70
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
71
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
70
|
+
} from "../shared/@ai-setting/roy-agent-core-djpq6yb0.js";
|
|
71
|
+
import"../shared/@ai-setting/roy-agent-core-v85n42ve.js";
|
|
72
72
|
import"../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
73
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
73
|
+
import"../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
74
74
|
import {
|
|
75
75
|
XDG_PATHS,
|
|
76
76
|
getXDGPath,
|
|
77
77
|
getXDGPaths
|
|
78
78
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
79
79
|
import"../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
80
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
81
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
80
|
+
import"../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
81
|
+
import"../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
82
82
|
import"../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
83
83
|
import"../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
84
84
|
import"../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
85
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
85
|
+
import"../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
86
86
|
import {
|
|
87
87
|
PluginComponent
|
|
88
88
|
} from "../shared/@ai-setting/roy-agent-core-v6vr6za7.js";
|
|
89
|
-
import"../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
90
89
|
import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
90
|
+
import"../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
91
91
|
import {
|
|
92
92
|
McpComponent
|
|
93
93
|
} from "../shared/@ai-setting/roy-agent-core-6j02sbee.js";
|
package/dist/env/llm/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createLLMAdapter,
|
|
14
14
|
getLLMProviderOverride,
|
|
15
15
|
setLLMProvider
|
|
16
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
} from "../../shared/@ai-setting/roy-agent-core-264qexac.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-adg9ghbt.js";
|
|
18
18
|
import {
|
|
19
19
|
PiAiAdapter,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
isOpencodeEndpoint,
|
|
28
28
|
isOpencodeProvider,
|
|
29
29
|
parseModelString
|
|
30
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
30
|
+
} from "../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
31
31
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
32
32
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
33
33
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Orphan tool-call repair (Task #4992, P0).
|
|
3
|
+
*
|
|
4
|
+
* ── What is an orphan tool-call? ──────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* The AI SDK v6 prompt converter (`convertToLanguageModelPrompt`,
|
|
7
|
+
* node_modules/ai/dist/index.mjs:1359-1387) validates pairing with a
|
|
8
|
+
* POSITIONAL pending-set state machine, not a global id set:
|
|
9
|
+
*
|
|
10
|
+
* - an assistant tool-call ADDs its id to the pending set;
|
|
11
|
+
* - a tool-result REMOVES its id from the pending set;
|
|
12
|
+
* - when a user/system message is reached and the pending set is
|
|
13
|
+
* NOT empty, it throws AI_MissingToolResultsError — the run dies.
|
|
14
|
+
*
|
|
15
|
+
* Therefore a tool-result that arrives AFTER the next user/system
|
|
16
|
+
* message does NOT pair with its tool-call. An orphan is any
|
|
17
|
+
* tool-call still pending when the next user/system message arrives
|
|
18
|
+
* (or at end-of-history).
|
|
19
|
+
*
|
|
20
|
+
* ── How are orphans produced? ──────────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* When the context threshold is exceeded, `LLMComponent.finalizeOutput()`
|
|
23
|
+
* throws a `ContextError` AFTER the LLM already returned tool calls. The
|
|
24
|
+
* `AgentComponent` catch block persists that assistant message for the
|
|
25
|
+
* compaction pipeline, but (before Defence 1) never wrote the placeholder
|
|
26
|
+
* tool-results — the iteration's `iterAllToolCalls` still holds the
|
|
27
|
+
* PREVIOUS iteration's value. Result: pending tool-calls land in
|
|
28
|
+
* sessions.db with no positional pairing → next AI SDK fallback throws
|
|
29
|
+
* `AI_MissingToolResultsError` and kills the run (production kill chain:
|
|
30
|
+
* Task #4983, session_1bba0d11).
|
|
31
|
+
*
|
|
32
|
+
* ── Two defences, one helper ───────────────────────────────────
|
|
33
|
+
*
|
|
34
|
+
* 1. Defence 1 (produce-side): AgentComponent emits placeholders when
|
|
35
|
+
* persisting the ContextError assistant message — root cause.
|
|
36
|
+
* 2. Defence 2 (consume-side): the AI SDK fallback path (invoke.ts) runs
|
|
37
|
+
* `repairOrphanSdkMessages()` on the history BEFORE `streamText()`, so
|
|
38
|
+
* ANY source of orphans (legacy sessions, crashes, ...) can no longer
|
|
39
|
+
* throw `AI_MissingToolResultsError`. Defence in depth.
|
|
40
|
+
*/
|
|
41
|
+
import type { LLMMessage } from "./types";
|
|
42
|
+
import type { ModelMessage } from "ai";
|
|
43
|
+
/** Placeholder text written for a tool call whose run was interrupted. */
|
|
44
|
+
export declare const ORPHAN_PLACEHOLDER_PREFIX = "[Tool result missing: run interrupted]";
|
|
45
|
+
export interface OrphanToolCall {
|
|
46
|
+
toolCallId: string;
|
|
47
|
+
toolName: string;
|
|
48
|
+
/**
|
|
49
|
+
* Index of the message that triggered the orphan detection
|
|
50
|
+
* (the user/system boundary, or the last message for
|
|
51
|
+
* end-of-history orphans). The repair inserts the placeholder
|
|
52
|
+
* result at exactly this boundary, matching AI SDK semantics.
|
|
53
|
+
*/
|
|
54
|
+
messageIndex: number;
|
|
55
|
+
}
|
|
56
|
+
export interface OrphanRepairResult<M = LLMMessage> {
|
|
57
|
+
messages: M[];
|
|
58
|
+
orphans: OrphanToolCall[];
|
|
59
|
+
repairedCount: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Scan a message history for orphan tool-calls with POSITIONAL
|
|
63
|
+
* pending-set semantics — the exact model AI SDK v6 uses in
|
|
64
|
+
* `convertToLanguageModelPrompt` (node_modules/ai/dist/index.mjs:1359-1387):
|
|
65
|
+
*
|
|
66
|
+
* - assistant tool-call → id added to the pending set;
|
|
67
|
+
* - tool-result → id removed;
|
|
68
|
+
* - on user/system message with a non-empty pending set → those
|
|
69
|
+
* pending calls are orphans (AI SDK would throw here);
|
|
70
|
+
* - at end of history, still-pending calls are orphans too.
|
|
71
|
+
*
|
|
72
|
+
* A tool-result that appears after the next user/system message can
|
|
73
|
+
* never satisfy its tool-call — matching the AI SDK behavior exactly.
|
|
74
|
+
*
|
|
75
|
+
* Pure function — does not mutate the input.
|
|
76
|
+
*/
|
|
77
|
+
export declare function findOrphanToolCalls(messages: LLMMessage[]): OrphanToolCall[];
|
|
78
|
+
/**
|
|
79
|
+
* Repair a history by inserting one placeholder `tool` message per
|
|
80
|
+
* orphan tool-call AT THE ORPHAN BOUNDARY (just before the user/system
|
|
81
|
+
* message that triggers the AI SDK throw, or appended at end of
|
|
82
|
+
* history). This restores positional pairing per AI SDK v6 semantics.
|
|
83
|
+
*
|
|
84
|
+
* - Input is NOT mutated; when there are no orphans the SAME array
|
|
85
|
+
* reference is returned (zero-copy fast path).
|
|
86
|
+
* - The placeholder output is a JSON string
|
|
87
|
+
* `{ error: "[Tool result missing: run interrupted] <reason>" }`.
|
|
88
|
+
*/
|
|
89
|
+
export declare function repairOrphanToolCalls(messages: LLMMessage[], options?: {
|
|
90
|
+
reason?: string;
|
|
91
|
+
}): OrphanRepairResult<LLMMessage>;
|
|
92
|
+
/**
|
|
93
|
+
* Same positional repair as `repairOrphanToolCalls`, but for AI SDK
|
|
94
|
+
* `ModelMessage[]` (post-`convertToSDKMessages`). In this shape the
|
|
95
|
+
* assistant tool-calls live inside `content` as `tool-call` parts, and
|
|
96
|
+
* tool results are `tool` role messages whose `content` is an array of
|
|
97
|
+
* `tool-result` parts.
|
|
98
|
+
*
|
|
99
|
+
* The placeholder result is emitted in the exact AI SDK v6 wire shape:
|
|
100
|
+
* `{ role: "tool", content: [{ type: "tool-result", toolCallId, toolName,
|
|
101
|
+
* output: { type: "text", value } }] }`.
|
|
102
|
+
*/
|
|
103
|
+
export declare function repairOrphanSdkMessages(messages: ModelMessage[], options?: {
|
|
104
|
+
reason?: string;
|
|
105
|
+
}): OrphanRepairResult<ModelMessage> & {
|
|
106
|
+
messages: ModelMessage[];
|
|
107
|
+
};
|
package/dist/env/plugin/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
EventBusNotificationChannel,
|
|
3
3
|
PluginComponent
|
|
4
4
|
} from "../../shared/@ai-setting/roy-agent-core-v6vr6za7.js";
|
|
5
|
-
import {
|
|
6
|
-
normalizeLarkAtMentions
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
8
5
|
import {
|
|
9
6
|
BasePlugin
|
|
10
7
|
} from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
8
|
+
import {
|
|
9
|
+
normalizeLarkAtMentions
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-m880qz3y.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-29b6hc39.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
8
|
+
import"../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|