@ai-setting/roy-agent-core 1.7.37 → 1.7.38
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 +7 -7
- package/dist/env/agent/index.js +10 -10
- package/dist/env/commands/index.js +7 -7
- package/dist/env/context/index.js +3 -3
- package/dist/env/debug/index.js +7 -7
- package/dist/env/event-source/index.js +24 -14
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +33 -32
- package/dist/env/llm/index.js +7 -7
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/mcp/index.js +7 -7
- package/dist/env/memory/index.js +7 -7
- package/dist/env/plugin/index.js +7 -7
- package/dist/env/prompt/index.js +7 -7
- package/dist/env/session/index.js +7 -7
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +7 -6
- package/dist/env/task/index.js +12 -11
- package/dist/env/task/plugins/index.js +7 -7
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/tools/index.js +3 -3
- package/dist/env/tool/built-in/index.js +2 -2
- package/dist/env/tool/index.js +8 -8
- package/dist/env/workflow/engine/index.js +9 -9
- package/dist/env/workflow/index.js +17 -17
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/service/index.js +2 -2
- package/dist/env/workflow/storage/index.js +3 -3
- package/dist/env/workflow/tools/index.js +11 -11
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +53 -43
- package/dist/shared/@ai-setting/{roy-agent-core-yf0ex8y1.js → roy-agent-core-333apxaa.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mdaew65f.js → roy-agent-core-3m7j2wcb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9drbkjfr.js → roy-agent-core-4cj6hram.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zda3rfr3.js → roy-agent-core-4kbvfnn1.js} +54 -5
- package/dist/shared/@ai-setting/{roy-agent-core-88tfzaxg.js → roy-agent-core-5gpf5j51.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jq7g5nxz.js → roy-agent-core-5j4awbgc.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-wgttzq8e.js → roy-agent-core-6vbgswjw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pxyyrxnn.js → roy-agent-core-83j0v0hs.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-j9ejsmsj.js → roy-agent-core-8nv07zgr.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-a8zf7ts4.js → roy-agent-core-970btnjh.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-yw07bvqz.js → roy-agent-core-9cqpdrnk.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-q3zvkbj6.js → roy-agent-core-9qn92jhf.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-462v5d24.js → roy-agent-core-9wsy4yfv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qhjm0bxm.js → roy-agent-core-a9pbda78.js} +23 -13
- package/dist/shared/@ai-setting/{roy-agent-core-mxwaq8ey.js → roy-agent-core-cd9h49ng.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-ds5f75pg.js → roy-agent-core-ck60j1q9.js} +19 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2qke91fm.js → roy-agent-core-dfnyvxr9.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-zekkw27m.js → roy-agent-core-e02f0ywc.js} +69 -24
- package/dist/shared/@ai-setting/{roy-agent-core-e4v61k3j.js → roy-agent-core-e5pnnzdm.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-1btakphh.js → roy-agent-core-e8rxb9a6.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-whta3f53.js → roy-agent-core-ff2ssff5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-s53yya0w.js → roy-agent-core-gh6szaj5.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-em8618g6.js → roy-agent-core-gpf33hn9.js} +214 -13
- package/dist/shared/@ai-setting/{roy-agent-core-qhtejtpc.js → roy-agent-core-hfmpmt0k.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qz9jb9sp.js → roy-agent-core-hkj5v9xq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fytqnxrd.js → roy-agent-core-mzyzdf33.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-1vj7dd14.js → roy-agent-core-nz4n1w28.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-q8vew3zh.js → roy-agent-core-p0c98phj.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-dfay0w56.js → roy-agent-core-p2ham63a.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-d5gwqrr5.js → roy-agent-core-pd0exvnq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x4wev4rn.js → roy-agent-core-q3vbxprp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-e3qjt852.js → roy-agent-core-rgpkygbc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2wbdfrtg.js → roy-agent-core-rhfywyz1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-k5csz66y.js → roy-agent-core-tm57tmds.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-bb57xjfh.js → roy-agent-core-vh10qamt.js} +8 -8
- package/dist/shared/@ai-setting/{roy-agent-core-1q6gjxba.js → roy-agent-core-vn6f4nxv.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-1nvqn17p.js → roy-agent-core-wacnvjaq.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-dzfyjzgw.js → roy-agent-core-wb1b61f8.js} +20 -2
- package/dist/shared/@ai-setting/{roy-agent-core-mwaesrpc.js → roy-agent-core-wfpzny0h.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ddq5hcp5.js → roy-agent-core-x6c45yqd.js} +3 -1
- package/dist/shared/@ai-setting/roy-agent-core-xyys5m1a.js +159 -0
- package/dist/shared/@ai-setting/{roy-agent-core-wphva2vs.js → roy-agent-core-y1n63tse.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-w457586k.js → roy-agent-core-y7atw1kw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jcdsghyr.js → roy-agent-core-yjjqm4ww.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fym6zz5a.js → roy-agent-core-yjyvwxs4.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-rx8whb18.js → roy-agent-core-ym1hwrcm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-m7dppx2p.js → roy-agent-core-yv4anf1c.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-n82acszf.js → roy-agent-core-z4486eek.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-n3pwkwjh.js → roy-agent-core-za09t5g3.js} +1 -1
- package/package.json +1 -1
- /package/dist/shared/@ai-setting/{roy-agent-core-k5hxvaf0.js → roy-agent-core-3ztzc83c.js} +0 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultLarkCliRunner
|
|
3
|
+
} from "./roy-agent-core-ck60j1q9.js";
|
|
4
|
+
import {
|
|
5
|
+
getSharedEventStore
|
|
6
|
+
} from "./roy-agent-core-xyys5m1a.js";
|
|
1
7
|
import {
|
|
2
8
|
TaskTagPlugin,
|
|
3
9
|
createLarkCliTaskNotifyHook,
|
|
4
10
|
createPerTaskGroupChatPlugin
|
|
5
|
-
} from "./roy-agent-core-
|
|
11
|
+
} from "./roy-agent-core-e5pnnzdm.js";
|
|
6
12
|
import {
|
|
7
13
|
normalizeLarkAtMentions
|
|
8
14
|
} from "./roy-agent-core-rmn29nrh.js";
|
|
@@ -11,22 +17,23 @@ import {
|
|
|
11
17
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
12
18
|
import {
|
|
13
19
|
BaseComponent
|
|
14
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
15
21
|
import {
|
|
16
22
|
globalHookManager,
|
|
17
23
|
init_global_hook_manager
|
|
18
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
19
25
|
import {
|
|
20
26
|
init_context
|
|
21
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-ff2ssff5.js";
|
|
22
28
|
import {
|
|
23
29
|
createEnvContext,
|
|
24
30
|
runWithEnvContext
|
|
25
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
26
32
|
import {
|
|
27
33
|
TracedAs,
|
|
28
|
-
init_decorator
|
|
29
|
-
|
|
34
|
+
init_decorator,
|
|
35
|
+
wrapFunction
|
|
36
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
30
37
|
import {
|
|
31
38
|
createLogger,
|
|
32
39
|
getTracerProvider,
|
|
@@ -593,8 +600,8 @@ var bountyIMHandler = {
|
|
|
593
600
|
};
|
|
594
601
|
|
|
595
602
|
// src/env/event-source/event-source-handlers.ts
|
|
596
|
-
init_global_hook_manager();
|
|
597
603
|
import { spawn as spawn2 } from "child_process";
|
|
604
|
+
init_global_hook_manager();
|
|
598
605
|
init_context();
|
|
599
606
|
|
|
600
607
|
// src/env/event-source/bounty-cli-handler.ts
|
|
@@ -1366,9 +1373,35 @@ class LarkCliInstance {
|
|
|
1366
1373
|
};
|
|
1367
1374
|
const { metadata, replyChannel, recommendedAction } = extractMetadata(enrichedEvent, eventType);
|
|
1368
1375
|
const parentTaskId = await this.resolveChatTaskBinding(metadata?.chatId);
|
|
1376
|
+
const userId = this.extractUserId(rawEvent);
|
|
1377
|
+
let triggerEventId;
|
|
1378
|
+
const sharedStore = getSharedEventStore();
|
|
1379
|
+
if (sharedStore && larkCliHandler.emitTriggerEvent) {
|
|
1380
|
+
try {
|
|
1381
|
+
triggerEventId = await larkCliHandler.emitTriggerEvent({
|
|
1382
|
+
senderId: userId,
|
|
1383
|
+
text: undefined,
|
|
1384
|
+
metadata: {
|
|
1385
|
+
eventType,
|
|
1386
|
+
appId: metadata?.appId,
|
|
1387
|
+
chatId: metadata?.chatId,
|
|
1388
|
+
chatType: metadata?.chatType,
|
|
1389
|
+
messageId: metadata?.messageId,
|
|
1390
|
+
messageType: metadata?.messageType,
|
|
1391
|
+
senderId: userId,
|
|
1392
|
+
tenantKey: metadata?.tenantKey,
|
|
1393
|
+
profile: this.config.profile
|
|
1394
|
+
},
|
|
1395
|
+
rawEvent
|
|
1396
|
+
}, sharedStore);
|
|
1397
|
+
} catch (err) {
|
|
1398
|
+
console.error(`[LarkCliInstance] emitTriggerEvent failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1369
1401
|
const message = JSON.stringify({
|
|
1370
1402
|
rawData,
|
|
1371
|
-
recommendedAction
|
|
1403
|
+
recommendedAction,
|
|
1404
|
+
...triggerEventId ? { triggerEventId } : {}
|
|
1372
1405
|
});
|
|
1373
1406
|
const timestamp = Date.now();
|
|
1374
1407
|
const plugins = this.config.handleRule?.plugins || [];
|
|
@@ -1389,7 +1422,8 @@ class LarkCliInstance {
|
|
|
1389
1422
|
pluginEnabled,
|
|
1390
1423
|
replyChannel,
|
|
1391
1424
|
agent,
|
|
1392
|
-
parentTaskId: parentTaskId ?? undefined
|
|
1425
|
+
parentTaskId: parentTaskId ?? undefined,
|
|
1426
|
+
...triggerEventId ? { triggerEventId } : {}
|
|
1393
1427
|
},
|
|
1394
1428
|
payload: {
|
|
1395
1429
|
sourceId: this.config.id,
|
|
@@ -1400,10 +1434,10 @@ class LarkCliInstance {
|
|
|
1400
1434
|
replyChannel,
|
|
1401
1435
|
recommendedAction,
|
|
1402
1436
|
timestamp,
|
|
1403
|
-
parentTaskId: parentTaskId ?? undefined
|
|
1437
|
+
parentTaskId: parentTaskId ?? undefined,
|
|
1438
|
+
...triggerEventId ? { triggerEventId } : {}
|
|
1404
1439
|
}
|
|
1405
1440
|
};
|
|
1406
|
-
const userId = this.extractUserId(rawEvent);
|
|
1407
1441
|
const envReplyChannel = this.buildReplyChannel(replyChannel);
|
|
1408
1442
|
const larkMessageId = replyChannel?.messageId ?? metadata?.messageId;
|
|
1409
1443
|
const envContext = createEnvContext({
|
|
@@ -1564,8 +1598,169 @@ var larkCliHandler = {
|
|
|
1564
1598
|
},
|
|
1565
1599
|
createInstance(config) {
|
|
1566
1600
|
return new LarkCliInstance(config);
|
|
1601
|
+
},
|
|
1602
|
+
async emitTriggerEvent(payload, store) {
|
|
1603
|
+
const eventId = await store.insertTriggerEvent(payload, "lark-cli");
|
|
1604
|
+
logger.info(`[larkCliHandler] emitTriggerEvent: id=${eventId}`, {
|
|
1605
|
+
chatId: payload.metadata?.chatId,
|
|
1606
|
+
senderId: payload.senderId
|
|
1607
|
+
});
|
|
1608
|
+
return eventId;
|
|
1609
|
+
},
|
|
1610
|
+
async replyMessage(input) {
|
|
1611
|
+
const runner = getLarkCliRunner();
|
|
1612
|
+
const profileFlag = input.profile ? `--profile ${input.profile} ` : "";
|
|
1613
|
+
const msgType = input.msgType ?? "text";
|
|
1614
|
+
const safeContent = input.content.replace(/'/g, `'\\''`);
|
|
1615
|
+
const command = `lark-cli ${profileFlag}im +messages-reply ` + `--message-id ${input.messageId} ` + `--chat-id ${input.chatId} ` + `--as bot ` + `--msg-type ${msgType} ` + `--content '${safeContent}'`;
|
|
1616
|
+
try {
|
|
1617
|
+
const result = await runner.run(command);
|
|
1618
|
+
if (result.code !== 0) {
|
|
1619
|
+
logger.error(`[larkCliHandler] replyMessage non-zero exit`, {
|
|
1620
|
+
code: result.code,
|
|
1621
|
+
stderr: result.stderr
|
|
1622
|
+
});
|
|
1623
|
+
return { success: false, error: result.stderr || `exit ${result.code}` };
|
|
1624
|
+
}
|
|
1625
|
+
let replyMessageId;
|
|
1626
|
+
try {
|
|
1627
|
+
const parsed = JSON.parse(result.stdout);
|
|
1628
|
+
replyMessageId = parsed?.data?.message_id ?? parsed?.message_id;
|
|
1629
|
+
} catch {}
|
|
1630
|
+
return { success: true, messageId: replyMessageId };
|
|
1631
|
+
} catch (err) {
|
|
1632
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1633
|
+
logger.error(`[larkCliHandler] replyMessage spawn error`, { error: errMsg });
|
|
1634
|
+
return { success: false, error: errMsg };
|
|
1635
|
+
}
|
|
1636
|
+
},
|
|
1637
|
+
extractReplyContext(event, profile) {
|
|
1638
|
+
return {
|
|
1639
|
+
esType: "lark-cli",
|
|
1640
|
+
chatId: event.metadata?.chatId ?? "",
|
|
1641
|
+
messageId: event.metadata?.messageId ?? "",
|
|
1642
|
+
senderOpenId: event.metadata?.senderId ?? event.senderId,
|
|
1643
|
+
tenantKey: event.metadata?.tenantKey ?? undefined,
|
|
1644
|
+
profile: profile ?? event.metadata?.profile ?? undefined
|
|
1645
|
+
};
|
|
1646
|
+
},
|
|
1647
|
+
buildNotifyHandlePrompt(input) {
|
|
1648
|
+
const ctx = this.extractReplyContext?.(input.triggerEvent, input.profile) ?? {
|
|
1649
|
+
esType: "lark-cli",
|
|
1650
|
+
chatId: input.triggerEvent.metadata?.chatId ?? "",
|
|
1651
|
+
messageId: input.triggerEvent.metadata?.messageId ?? "",
|
|
1652
|
+
senderOpenId: input.triggerEvent.metadata?.senderId ?? input.triggerEvent.senderId,
|
|
1653
|
+
profile: input.profile
|
|
1654
|
+
};
|
|
1655
|
+
const profileFlag = ctx.profile ? `--profile ${ctx.profile} ` : "";
|
|
1656
|
+
const desc = input.notifyEvent.description ?? "(未命名任务)";
|
|
1657
|
+
const result = input.subAgentResult.summary ?? input.notifyEvent.result ?? "";
|
|
1658
|
+
const promptText = `
|
|
1659
|
+
## Notify Event: ${input.notifyEvent.type}
|
|
1660
|
+
|
|
1661
|
+
Sub-agent 完成了 Task #${input.notifyEvent.taskId ?? "?"}「${desc}」。
|
|
1662
|
+
|
|
1663
|
+
### Trigger event(原始飞书消息,来自 EventStore 反查)
|
|
1664
|
+
- ES: lark-cli
|
|
1665
|
+
- **chatId: ${ctx.chatId}** ← 关键!必须回复到这里
|
|
1666
|
+
- **messageId: ${ctx.messageId}** ← 必须 reply 这条
|
|
1667
|
+
- sender: ${ctx.senderOpenId}
|
|
1668
|
+
${ctx.profile ? `- profile: ${ctx.profile} ← 调用 lark-cli 必须带 --profile
|
|
1669
|
+
` : ""}
|
|
1670
|
+
### Sub-agent 输出
|
|
1671
|
+
${result}
|
|
1672
|
+
|
|
1673
|
+
### \uD83D\uDC49 你应该这样做
|
|
1674
|
+
用 lark-cli 调 im +messages-reply:
|
|
1675
|
+
lark-cli ${profileFlag}im +messages-reply --message-id ${ctx.messageId} --chat-id ${ctx.chatId} --as bot --msg-type text --content '<你的回复>'
|
|
1676
|
+
|
|
1677
|
+
⚠️ 不要 fallback 到 lastReplyChannel 或 metadata.replyChannel — 那个 chatId
|
|
1678
|
+
可能跟用户原始消息的 chatId 不一致(参见 #4035/#4038/#4039 bug)。
|
|
1679
|
+
`;
|
|
1680
|
+
const systemHint = `回复必须用 lark-cli im +messages-reply(${profileFlag.trim() ? `带 ${profileFlag.trim()};` : ""}` + `chatId=${ctx.chatId} / messageId=${ctx.messageId} 来自 trigger event,不要 fallback。`;
|
|
1681
|
+
return { promptText, systemHint };
|
|
1682
|
+
},
|
|
1683
|
+
setRunner(runner) {
|
|
1684
|
+
setLarkCliRunner(runner);
|
|
1685
|
+
},
|
|
1686
|
+
async postProcessNotifyEvent(input) {
|
|
1687
|
+
try {
|
|
1688
|
+
const chats = await searchChatsByTaskId(input.notifyEvent.taskId, input.profile);
|
|
1689
|
+
for (const chatId of chats) {
|
|
1690
|
+
try {
|
|
1691
|
+
await sendMarkdownToChat(chatId, input.formattedPrompt, input.profile);
|
|
1692
|
+
} catch (err) {
|
|
1693
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1694
|
+
logger.error(`[larkCliHandler] postProcessNotifyEvent: send failed for chatId=${chatId}`, { error: errMsg });
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
} catch (err) {
|
|
1698
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1699
|
+
logger.error(`[larkCliHandler] postProcessNotifyEvent failed`, {
|
|
1700
|
+
error: errMsg
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1567
1703
|
}
|
|
1568
1704
|
};
|
|
1705
|
+
if (larkCliHandler.extractReplyContext) {
|
|
1706
|
+
larkCliHandler.extractReplyContext = wrapFunction(larkCliHandler.extractReplyContext, "extractReplyContext", { recordParams: true, recordResult: true, recordError: true });
|
|
1707
|
+
}
|
|
1708
|
+
if (larkCliHandler.buildNotifyHandlePrompt) {
|
|
1709
|
+
larkCliHandler.buildNotifyHandlePrompt = wrapFunction(larkCliHandler.buildNotifyHandlePrompt, "buildNotifyHandlePrompt", { recordParams: true, recordResult: false, recordError: true });
|
|
1710
|
+
}
|
|
1711
|
+
if (larkCliHandler.postProcessNotifyEvent) {
|
|
1712
|
+
larkCliHandler.postProcessNotifyEvent = wrapFunction(larkCliHandler.postProcessNotifyEvent, "postProcessNotifyEvent", { recordParams: true, recordResult: false, recordError: true });
|
|
1713
|
+
}
|
|
1714
|
+
async function searchChatsByTaskId(taskId, profile) {
|
|
1715
|
+
if (!taskId)
|
|
1716
|
+
return [];
|
|
1717
|
+
const profileFlag = profile ? `--profile ${profile} ` : "";
|
|
1718
|
+
const runner = getLarkCliRunner();
|
|
1719
|
+
const command = `lark-cli ${profileFlag}im +chat-search ` + `--query "Task ${taskId}" --as bot --format json`;
|
|
1720
|
+
const result = await runner.run(command);
|
|
1721
|
+
if (result.code !== 0) {
|
|
1722
|
+
logger.warn(`[larkCliHandler] chat-search non-zero exit`, {
|
|
1723
|
+
code: result.code,
|
|
1724
|
+
stderr: result.stderr
|
|
1725
|
+
});
|
|
1726
|
+
return [];
|
|
1727
|
+
}
|
|
1728
|
+
let parsed;
|
|
1729
|
+
try {
|
|
1730
|
+
parsed = JSON.parse(result.stdout);
|
|
1731
|
+
} catch {
|
|
1732
|
+
logger.warn(`[larkCliHandler] chat-search stdout is not JSON`, {
|
|
1733
|
+
stdout: result.stdout.slice(0, 200)
|
|
1734
|
+
});
|
|
1735
|
+
return [];
|
|
1736
|
+
}
|
|
1737
|
+
const items = parsed?.items ?? parsed?.data?.items ?? parsed?.data?.chats ?? [];
|
|
1738
|
+
const ids = [];
|
|
1739
|
+
for (const item of items) {
|
|
1740
|
+
const cid = item?.chat_id ?? item?.chatId ?? item?.id;
|
|
1741
|
+
if (typeof cid === "string" && cid.length > 0) {
|
|
1742
|
+
ids.push(cid);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return ids;
|
|
1746
|
+
}
|
|
1747
|
+
async function sendMarkdownToChat(chatId, markdown, profile) {
|
|
1748
|
+
const profileFlag = profile ? `--profile ${profile} ` : "";
|
|
1749
|
+
const runner = getLarkCliRunner();
|
|
1750
|
+
const safeMd = markdown.replace(/'/g, `'\\''`);
|
|
1751
|
+
const command = `lark-cli ${profileFlag}im +messages-send ` + `--chat-id "${chatId}" --as bot --markdown '${safeMd}'`;
|
|
1752
|
+
const result = await runner.run(command);
|
|
1753
|
+
if (result.code !== 0) {
|
|
1754
|
+
throw new Error(`messages-send exit ${result.code}: ${result.stderr || "(no stderr)"}`);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
var _larkCliRunner = defaultLarkCliRunner;
|
|
1758
|
+
function getLarkCliRunner() {
|
|
1759
|
+
return _larkCliRunner;
|
|
1760
|
+
}
|
|
1761
|
+
function setLarkCliRunner(runner) {
|
|
1762
|
+
_larkCliRunner = runner;
|
|
1763
|
+
}
|
|
1569
1764
|
var builtInHandlers = [
|
|
1570
1765
|
larkCliHandler,
|
|
1571
1766
|
timerHandler,
|
|
@@ -1672,7 +1867,7 @@ class EventSourceComponent extends BaseComponent {
|
|
|
1672
1867
|
}
|
|
1673
1868
|
}
|
|
1674
1869
|
async executeInitHooks() {
|
|
1675
|
-
const { EventSourceInitHooks } = await import("./roy-agent-core-
|
|
1870
|
+
const { EventSourceInitHooks } = await import("./roy-agent-core-x6c45yqd.js");
|
|
1676
1871
|
await EventSourceInitHooks.execute(this);
|
|
1677
1872
|
}
|
|
1678
1873
|
registerHandler(handler) {
|
|
@@ -2019,5 +2214,11 @@ class EventSourceComponent extends BaseComponent {
|
|
|
2019
2214
|
__legacyDecorateClassTS([
|
|
2020
2215
|
TracedAs("event-source.update", { recordParams: false, log: false })
|
|
2021
2216
|
], EventSourceComponent.prototype, "update", null);
|
|
2217
|
+
__legacyDecorateClassTS([
|
|
2218
|
+
TracedAs("event_source.start", { recordParams: true, recordResult: false })
|
|
2219
|
+
], EventSourceComponent.prototype, "startSource", null);
|
|
2220
|
+
__legacyDecorateClassTS([
|
|
2221
|
+
TracedAs("event_source.stop", { recordParams: true, recordResult: false })
|
|
2222
|
+
], EventSourceComponent.prototype, "stopSource", null);
|
|
2022
2223
|
|
|
2023
2224
|
export { TimerInstance, timerHandler, buildDefaultBountyIMSystemPrompt, resolveBountyIMSystemPrompt, BountyIMInstance, bountyIMHandler, extractMetadata, larkCliHandler, builtInHandlers, getBuiltInHandler, EventSourceComponent };
|
|
@@ -19,17 +19,17 @@ import {
|
|
|
19
19
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
20
20
|
import {
|
|
21
21
|
BaseComponent
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
23
23
|
import {
|
|
24
24
|
LLMHookPoints,
|
|
25
25
|
globalHookManager,
|
|
26
26
|
init_global_hook_manager
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
28
28
|
import {
|
|
29
29
|
TracedAs,
|
|
30
30
|
init_decorator,
|
|
31
31
|
wrapFunction
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
33
33
|
import {
|
|
34
34
|
createLogger,
|
|
35
35
|
init_logger
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
globalHookManager,
|
|
11
11
|
init_global_hook_manager
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
13
13
|
import {
|
|
14
14
|
TracedAs,
|
|
15
15
|
init_decorator,
|
|
16
16
|
wrapFunction
|
|
17
|
-
} from "./roy-agent-core-
|
|
17
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
18
18
|
import {
|
|
19
19
|
createLogger,
|
|
20
20
|
init_logger
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
7
7
|
import {
|
|
8
8
|
init_decorator
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
10
10
|
import {
|
|
11
11
|
createLogger,
|
|
12
12
|
getTracerProvider,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AgentComponentAdapter,
|
|
9
9
|
init_agent_component_adapter
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-p0c98phj.js";
|
|
11
11
|
import {
|
|
12
12
|
PythonCallNode,
|
|
13
13
|
SkillNode,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
init_skill_node,
|
|
18
18
|
init_tool_node,
|
|
19
19
|
init_workflow_node
|
|
20
|
-
} from "./roy-agent-core-
|
|
20
|
+
} from "./roy-agent-core-yjjqm4ww.js";
|
|
21
21
|
import {
|
|
22
22
|
WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
|
|
23
23
|
init_json_schema_to_zod,
|
|
@@ -29,11 +29,11 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
TemplateResolver,
|
|
31
31
|
init_template_resolver
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-333apxaa.js";
|
|
33
33
|
import {
|
|
34
34
|
DAGManager,
|
|
35
35
|
init_dag_manager
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-tm57tmds.js";
|
|
37
37
|
import {
|
|
38
38
|
WorkflowError,
|
|
39
39
|
createWorkflowEvent,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
import {
|
|
50
50
|
TracedAs,
|
|
51
51
|
init_decorator
|
|
52
|
-
} from "./roy-agent-core-
|
|
52
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
53
53
|
import {
|
|
54
54
|
createLogger,
|
|
55
55
|
init_logger
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
truncateOutputInline
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-wfpzny0h.js";
|
|
4
4
|
import {
|
|
5
5
|
AgentRegistry
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-za09t5g3.js";
|
|
7
7
|
import {
|
|
8
8
|
enqueueToAddFakeUserMessage
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-4cj6hram.js";
|
|
10
10
|
import {
|
|
11
11
|
SessionMessageConverter
|
|
12
12
|
} from "./roy-agent-core-djdwq743.js";
|
|
@@ -29,23 +29,23 @@ import {
|
|
|
29
29
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
30
30
|
import {
|
|
31
31
|
BaseComponent
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
33
33
|
import {
|
|
34
34
|
globalHookManager,
|
|
35
35
|
init_global_hook_manager
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
37
37
|
import {
|
|
38
38
|
init_context
|
|
39
|
-
} from "./roy-agent-core-
|
|
39
|
+
} from "./roy-agent-core-ff2ssff5.js";
|
|
40
40
|
import {
|
|
41
41
|
getCurrentTaskId,
|
|
42
42
|
getEnvContext,
|
|
43
43
|
runWithEnvContextAsync
|
|
44
|
-
} from "./roy-agent-core-
|
|
44
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
45
45
|
import {
|
|
46
46
|
TracedAs,
|
|
47
47
|
init_decorator
|
|
48
|
-
} from "./roy-agent-core-
|
|
48
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
49
49
|
import {
|
|
50
50
|
createLogger,
|
|
51
51
|
init_logger
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
searchTasksTool,
|
|
10
10
|
treeTasksTool,
|
|
11
11
|
updateTaskTool
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-hfmpmt0k.js";
|
|
13
13
|
import {
|
|
14
14
|
createOperationTool,
|
|
15
15
|
deleteOperationTool,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
BackgroundTaskManager,
|
|
28
28
|
createDelegateTool,
|
|
29
29
|
createStopTool
|
|
30
|
-
} from "./roy-agent-core-
|
|
30
|
+
} from "./roy-agent-core-e02f0ywc.js";
|
|
31
31
|
import {
|
|
32
32
|
SQLiteTaskStore,
|
|
33
33
|
getDefaultTaskDbPath
|
|
34
|
-
} from "./roy-agent-core-
|
|
34
|
+
} from "./roy-agent-core-wb1b61f8.js";
|
|
35
35
|
import {
|
|
36
36
|
TaskHookPoints
|
|
37
37
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -40,19 +40,19 @@ import {
|
|
|
40
40
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
41
41
|
import {
|
|
42
42
|
BaseComponent
|
|
43
|
-
} from "./roy-agent-core-
|
|
43
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
44
44
|
import {
|
|
45
45
|
globalHookManager,
|
|
46
46
|
init_global_hook_manager
|
|
47
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
48
48
|
import {
|
|
49
49
|
getEnvContextOrEmpty,
|
|
50
50
|
init_env_context
|
|
51
|
-
} from "./roy-agent-core-
|
|
51
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
52
52
|
import {
|
|
53
53
|
TracedAs,
|
|
54
54
|
init_decorator
|
|
55
|
-
} from "./roy-agent-core-
|
|
55
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
56
56
|
import {
|
|
57
57
|
createLogger,
|
|
58
58
|
init_logger
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-rmn29nrh.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-yv4anf1c.js";
|
|
7
7
|
import {
|
|
8
8
|
globalHookManager,
|
|
9
9
|
init_global_hook_manager
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-yjyvwxs4.js";
|
|
11
11
|
import {
|
|
12
12
|
init_context
|
|
13
|
-
} from "./roy-agent-core-
|
|
13
|
+
} from "./roy-agent-core-ff2ssff5.js";
|
|
14
14
|
import {
|
|
15
15
|
getEnvContextOrEmpty
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
17
17
|
import {
|
|
18
18
|
createLogger,
|
|
19
19
|
init_logger
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TracedAs,
|
|
3
3
|
init_decorator
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
5
5
|
import {
|
|
6
6
|
createLogger,
|
|
7
7
|
init_logger
|
|
@@ -686,11 +686,29 @@ var init_sqlite_task_store = __esm(() => {
|
|
|
686
686
|
createdAt: new Date(row.created_at).toISOString(),
|
|
687
687
|
updatedAt: new Date(row.updated_at).toISOString(),
|
|
688
688
|
due_date: row.due_date ? String(row.due_date) : undefined,
|
|
689
|
-
tags:
|
|
689
|
+
tags: SQLiteTaskStore.parseTagsSafely(row.tags),
|
|
690
690
|
project_path: String(row.project_path ?? "unknown"),
|
|
691
691
|
context: row.context
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
|
+
static parseTagsSafely(raw) {
|
|
695
|
+
if (raw === null || raw === undefined || raw === "") {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const str = typeof raw === "string" ? raw : String(raw);
|
|
699
|
+
try {
|
|
700
|
+
const parsed = JSON.parse(str);
|
|
701
|
+
if (Array.isArray(parsed)) {
|
|
702
|
+
return parsed;
|
|
703
|
+
}
|
|
704
|
+
if (typeof parsed === "string") {
|
|
705
|
+
return [parsed];
|
|
706
|
+
}
|
|
707
|
+
return;
|
|
708
|
+
} catch {
|
|
709
|
+
return [str];
|
|
710
|
+
}
|
|
711
|
+
}
|
|
694
712
|
rowToOperation(row) {
|
|
695
713
|
const milestoneType = row.milestone_type ?? row.action_type;
|
|
696
714
|
const milestoneTitle = row.milestone_title ?? row.action_title;
|
|
@@ -11,20 +11,20 @@ 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-yv4anf1c.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-yjyvwxs4.js";
|
|
20
20
|
import {
|
|
21
21
|
getCurrentTaskId,
|
|
22
22
|
init_env_context
|
|
23
|
-
} from "./roy-agent-core-
|
|
23
|
+
} from "./roy-agent-core-z4486eek.js";
|
|
24
24
|
import {
|
|
25
25
|
TracedAs,
|
|
26
26
|
init_decorator
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-a9pbda78.js";
|
|
28
28
|
import {
|
|
29
29
|
createLogger,
|
|
30
30
|
init_logger
|
|
@@ -2,17 +2,19 @@ import {
|
|
|
2
2
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
3
3
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
4
4
|
EventSourceInitHooks,
|
|
5
|
+
defaultLarkCliRunner,
|
|
5
6
|
getDefaultConfigForType,
|
|
6
7
|
isBuiltInEventSourceType,
|
|
7
8
|
isValidEventSourceType,
|
|
8
9
|
validateEventSourceConfig
|
|
9
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-ck60j1q9.js";
|
|
10
11
|
import"./roy-agent-core-fs0mn2jk.js";
|
|
11
12
|
export {
|
|
12
13
|
validateEventSourceConfig,
|
|
13
14
|
isValidEventSourceType,
|
|
14
15
|
isBuiltInEventSourceType,
|
|
15
16
|
getDefaultConfigForType,
|
|
17
|
+
defaultLarkCliRunner,
|
|
16
18
|
EventSourceInitHooks,
|
|
17
19
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
18
20
|
BUILT_IN_EVENT_SOURCE_TYPES
|