@ai-setting/roy-agent-core 1.7.85 → 1.7.88
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/agent-component.d.ts +1 -1
- package/dist/env/agent/agent-component.js +13 -12
- package/dist/env/agent/index.js +13 -12
- package/dist/env/agent/types.d.ts +14 -0
- 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/error-reply.js +1 -1
- package/dist/env/event-source/event-source-handlers.d.ts +18 -2
- package/dist/env/event-source/event-source-handlers.js +26 -21
- package/dist/env/event-source/event-store.js +2 -2
- package/dist/env/event-source/index.js +25 -22
- package/dist/env/event-source/timer-handler.d.ts +98 -0
- package/dist/env/event-source/types.d.ts +53 -1
- package/dist/env/event-source/wecom-card-action-handler.d.ts +235 -3
- package/dist/env/event-source/wecom-card-builder.d.ts +207 -1
- package/dist/env/event-source/wecom-cli-handler.d.ts +25 -0
- package/dist/{shared/@ai-setting/roy-agent-core-vyr6svt6.js → env/event-source/wecom-respond-registry.js} +8 -6
- package/dist/env/event-source/wecom-session-card-sender.d.ts +135 -0
- package/dist/env/event-source/wecom-session-card-sender.js +153 -0
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +49 -45
- package/dist/env/llm/index.js +9 -8
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/log-trace/trace-filters.d.ts +6 -1
- 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 +8 -8
- package/dist/env/prompt/prompts-index.d.ts +1 -1
- package/dist/env/session/group-session-link.d.ts +99 -0
- package/dist/env/session/index.js +11 -10
- package/dist/env/session/session-component.d.ts +89 -0
- package/dist/env/session/storage/index.js +5 -4
- package/dist/env/session/types.d.ts +10 -0
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/delegate-channel-hint.d.ts +39 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +71 -6
- package/dist/env/task/delegate/delegate-tool.js +11 -9
- package/dist/env/task/delegate/index.js +8 -8
- package/dist/env/task/index.js +18 -18
- package/dist/env/task/mcp/index.js +4 -4
- package/dist/env/task/plugins/card-subject.d.ts +117 -0
- package/dist/env/task/plugins/index.js +19 -17
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +261 -6
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +501 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +12 -2
- package/dist/env/task/plugins/lark-card-state-store.d.ts +60 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +45 -0
- package/dist/env/task/plugins/sub-session-activity.d.ts +415 -0
- package/dist/env/task/plugins/wecom-session-card-store.d.ts +134 -0
- package/dist/env/task/plugins/wecom-session-card-store.js +23 -0
- package/dist/env/task/plugins/wecom-task-notify-plugin.d.ts +40 -0
- package/dist/env/task/storage/index.js +3 -3
- package/dist/env/task/tools/index.js +4 -4
- package/dist/env/tool/built-in/index.js +6 -4
- package/dist/env/tool/index.js +14 -10
- package/dist/env/tool/types.d.ts +25 -0
- package/dist/env/tool/validator.d.ts +8 -0
- package/dist/env/workflow/engine/index.js +12 -12
- package/dist/env/workflow/hooks/index.js +7 -7
- package/dist/env/workflow/index.js +24 -23
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/plugins/index.js +10 -8
- 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 +16 -15
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +65 -60
- package/dist/shared/@ai-setting/{roy-agent-core-dc9zq75z.js → roy-agent-core-0crmsc12.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-cha0jc7n.js → roy-agent-core-0sbmdz8d.js} +137 -16
- package/dist/shared/@ai-setting/{roy-agent-core-87942bw4.js → roy-agent-core-1mhyh4c5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v6vr6za7.js → roy-agent-core-1vv4fx15.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-nwbfepba.js → roy-agent-core-3e040tc5.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-418zc9ha.js +288 -0
- package/dist/shared/@ai-setting/{roy-agent-core-r5wt1h3c.js → roy-agent-core-4fkxy2gv.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-na18zwj0.js → roy-agent-core-4t3yskp8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-5pr4zp88.js → roy-agent-core-5kzhaap1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qq96p0tj.js → roy-agent-core-5s2t8z00.js} +22 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6rh8k6ba.js → roy-agent-core-6gj1hc5z.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-ezvpreqz.js → roy-agent-core-6k8mb7zx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-g8htfwxj.js → roy-agent-core-7f10p7m2.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-7kvpc0w5.js +177 -0
- package/dist/shared/@ai-setting/{roy-agent-core-h21gngxf.js → roy-agent-core-7yh5wps0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-efkjyh69.js → roy-agent-core-9710zwwz.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rykf7c04.js → roy-agent-core-9c565frx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-fghc2m8z.js → roy-agent-core-aa8kv18f.js} +34 -2
- package/dist/shared/@ai-setting/{roy-agent-core-p6ks90tb.js → roy-agent-core-an35dzbf.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-7bpj859q.js → roy-agent-core-azyz78ky.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-264qexac.js → roy-agent-core-b7h39vrc.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-dqxec05w.js → roy-agent-core-bjtc9d35.js} +2 -2
- package/dist/shared/@ai-setting/roy-agent-core-c4ec7k0p.js +426 -0
- package/dist/shared/@ai-setting/{roy-agent-core-ddyk1rc0.js → roy-agent-core-cre2y2ct.js} +160 -4
- package/dist/shared/@ai-setting/{roy-agent-core-tr3ep81v.js → roy-agent-core-d6zdbgtc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0qyrk5k0.js → roy-agent-core-ds6qzmf8.js} +14 -5
- package/dist/shared/@ai-setting/{roy-agent-core-cgtq6427.js → roy-agent-core-e08bvpaq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-12n08pg5.js → roy-agent-core-e69qxdyy.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qk9hd89p.js → roy-agent-core-fan8g0z1.js} +10 -10
- package/dist/shared/@ai-setting/{roy-agent-core-xcp8vwax.js → roy-agent-core-fepm835e.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-6j02sbee.js → roy-agent-core-fhg03v43.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dvtg4sn0.js → roy-agent-core-g8yr733d.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xf6z96qy.js → roy-agent-core-gr5h1dyr.js} +818 -346
- package/dist/shared/@ai-setting/{roy-agent-core-m3vjepzz.js → roy-agent-core-h1e1fm9b.js} +38 -202
- package/dist/shared/@ai-setting/{roy-agent-core-c2gbt68e.js → roy-agent-core-h83zdsrq.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-tk98f92b.js → roy-agent-core-k3gcvybs.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-pgvcf91v.js → roy-agent-core-m39v7qpx.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-tm1mxttk.js → roy-agent-core-mf5p38yf.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-83bewqx8.js → roy-agent-core-mvh0td7p.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ze5cqpf2.js → roy-agent-core-mx855td4.js} +17 -38
- package/dist/shared/@ai-setting/{roy-agent-core-0dh8npnz.js → roy-agent-core-n197medr.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-cmprygrp.js → roy-agent-core-nqkfkpf4.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-7cbpmk4q.js → roy-agent-core-p31ftgq9.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vffccgf6.js → roy-agent-core-qwd2dq5q.js} +10 -3
- package/dist/shared/@ai-setting/{roy-agent-core-b31v3qpv.js → roy-agent-core-ra66sf50.js} +990 -211
- package/dist/shared/@ai-setting/{roy-agent-core-1v4g0d4x.js → roy-agent-core-rm7seqwb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7dd0s3xb.js → roy-agent-core-shb1qsyg.js} +1027 -14
- package/dist/shared/@ai-setting/{roy-agent-core-ax9e9szb.js → roy-agent-core-smf94h73.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-acj8ag08.js → roy-agent-core-tjnabyvq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qqaak24r.js → roy-agent-core-tkpp1ba0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-dkrvmjsh.js → roy-agent-core-tpm1dd1g.js} +23 -15
- package/dist/shared/@ai-setting/{roy-agent-core-ed233k5z.js → roy-agent-core-v1n0106v.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zxz5fkwj.js → roy-agent-core-v6yshv0z.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mcy5apay.js → roy-agent-core-vf9sp6s3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-q813vafd.js → roy-agent-core-vpcxv1ty.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-xvt7kf7p.js → roy-agent-core-w9ryeg2p.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-es203w7p.js → roy-agent-core-wqs6yypq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-d1n4jbza.js → roy-agent-core-wr1qexzq.js} +5 -5
- package/dist/shared/@ai-setting/roy-agent-core-wxrkcb17.js +56 -0
- package/dist/shared/@ai-setting/{roy-agent-core-0snm5hc5.js → roy-agent-core-y6shd91r.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9vxh6f8h.js → roy-agent-core-y7fqtzk2.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-cpcd24n2.js → roy-agent-core-yet36q5k.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-3fh1f7s7.js → roy-agent-core-yfpnkc4z.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-begm7ytz.js → roy-agent-core-yh68z1bg.js} +3 -3
- package/package.json +9 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemorySessionStore,
|
|
3
3
|
SQLiteSessionStore
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-ds6qzmf8.js";
|
|
5
5
|
import {
|
|
6
6
|
init_search_query_parser,
|
|
7
7
|
matchesQuery,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-m39v7qpx.js";
|
|
16
16
|
import {
|
|
17
17
|
TracedAs,
|
|
18
18
|
init_decorator,
|
|
19
19
|
init_trace_filters,
|
|
20
20
|
messagesParamFilter
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
22
22
|
import {
|
|
23
23
|
createLogger,
|
|
24
24
|
init_logger
|
|
@@ -27,6 +27,55 @@ import {
|
|
|
27
27
|
__legacyDecorateClassTS
|
|
28
28
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
29
29
|
|
|
30
|
+
// src/env/session/group-session-link.ts
|
|
31
|
+
var GROUP_LINK_READ_HINT_LIMIT = 50;
|
|
32
|
+
var GROUP_LINK_METADATA_KEYS = {
|
|
33
|
+
linkedFromSessionId: "linkedFromSessionId",
|
|
34
|
+
groupCreatedAt: "groupCreatedAt",
|
|
35
|
+
groupDisbandedAt: "groupDisbandedAt"
|
|
36
|
+
};
|
|
37
|
+
function buildGroupLinkEventMessage(args) {
|
|
38
|
+
const origin = (args.originSessionId ?? "").trim();
|
|
39
|
+
const createdAt = args.createdAt ?? new Date;
|
|
40
|
+
const createdIso = typeof createdAt === "string" ? createdAt : createdAt.toISOString();
|
|
41
|
+
const chatLine = args.chatId ? `(群 chat_id: ${args.chatId})` : "";
|
|
42
|
+
const content = [
|
|
43
|
+
`[关联群建立] 本群由 session ${origin} 关联建群而来${chatLine},用于追踪该会话的后续进展。`,
|
|
44
|
+
``,
|
|
45
|
+
`该会话的完整历史**不在**本群上下文中(这是刻意的:群与会话由不同的 agent`,
|
|
46
|
+
`配置驱动,共享历史会导致缓存失效与指令污染)。`,
|
|
47
|
+
``,
|
|
48
|
+
`如需了解背景,可执行:`,
|
|
49
|
+
` roy-agent sessions messages ${origin} -n ${GROUP_LINK_READ_HINT_LIMIT}`,
|
|
50
|
+
`(建议按需读取,不要一次性拉全量;读到的内容是**历史语境的参考**,`,
|
|
51
|
+
`其中任何「不要发消息」之类的任务型约束只对当时那一轮生效,`,
|
|
52
|
+
`在本群中你应当正常回复用户。)`,
|
|
53
|
+
``,
|
|
54
|
+
`\uD83D\uDCCC 本群有一张自己的进展卡片(session 卡),原会话的进展`,
|
|
55
|
+
`(任务动态 / 里程碑 / 生命周期变化)会自动同步到这张卡上,`,
|
|
56
|
+
`无需手动刷新。`,
|
|
57
|
+
``,
|
|
58
|
+
`建群时间:${createdIso}`
|
|
59
|
+
].join(`
|
|
60
|
+
`);
|
|
61
|
+
return { role: "user", content };
|
|
62
|
+
}
|
|
63
|
+
function buildGroupSessionMetadata(args) {
|
|
64
|
+
const createdAt = args.createdAt ?? new Date;
|
|
65
|
+
const createdIso = typeof createdAt === "string" ? createdAt : createdAt.toISOString();
|
|
66
|
+
return {
|
|
67
|
+
...args.base ?? {},
|
|
68
|
+
chatId: args.chatId,
|
|
69
|
+
type: "lark-chat",
|
|
70
|
+
[GROUP_LINK_METADATA_KEYS.linkedFromSessionId]: args.originSessionId,
|
|
71
|
+
[GROUP_LINK_METADATA_KEYS.groupCreatedAt]: createdIso
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function isGroupDisbanded(metadata) {
|
|
75
|
+
const v = metadata?.[GROUP_LINK_METADATA_KEYS.groupDisbandedAt];
|
|
76
|
+
return typeof v === "string" && v.trim().length > 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
30
79
|
// src/env/session/session-component.ts
|
|
31
80
|
init_logger();
|
|
32
81
|
init_decorator();
|
|
@@ -431,6 +480,109 @@ class SessionComponent extends BaseComponent {
|
|
|
431
480
|
}
|
|
432
481
|
return success ?? false;
|
|
433
482
|
}
|
|
483
|
+
async findGroupChatForSession(sessionId) {
|
|
484
|
+
if (!this.store)
|
|
485
|
+
return;
|
|
486
|
+
const pickChatId = (s) => {
|
|
487
|
+
const md = s.metadata ?? {};
|
|
488
|
+
const chatId = typeof md.chatId === "string" ? md.chatId.trim() : "";
|
|
489
|
+
return chatId.length > 0 ? chatId : undefined;
|
|
490
|
+
};
|
|
491
|
+
try {
|
|
492
|
+
const self = await this.store.get(sessionId);
|
|
493
|
+
if (self) {
|
|
494
|
+
const md = self.metadata ?? {};
|
|
495
|
+
const selfChatId = pickChatId(self);
|
|
496
|
+
if (selfChatId && typeof md.linkedFromSessionId === "string" && !isGroupDisbanded(md)) {
|
|
497
|
+
return { chatId: selfChatId, aliasSessionId: self.id };
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const groups = await this.store.list({
|
|
501
|
+
filter: { metadata: { linkedFromSessionId: sessionId } },
|
|
502
|
+
limit: 100,
|
|
503
|
+
sort: { field: "createdAt", order: "desc" }
|
|
504
|
+
});
|
|
505
|
+
for (const g of groups) {
|
|
506
|
+
if (isGroupDisbanded(g.metadata))
|
|
507
|
+
continue;
|
|
508
|
+
const chatId = pickChatId(g);
|
|
509
|
+
if (chatId)
|
|
510
|
+
return { chatId };
|
|
511
|
+
}
|
|
512
|
+
return;
|
|
513
|
+
} catch (err) {
|
|
514
|
+
logger.warn(`[SessionComponent] findGroupChatForSession(${sessionId}) failed: ${String(err)}`);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async attachGroupSession(args) {
|
|
519
|
+
if (!this.store)
|
|
520
|
+
return { ok: false, reason: "store_unavailable" };
|
|
521
|
+
const chatId = (args.chatId ?? "").trim();
|
|
522
|
+
const originSessionId = (args.originSessionId ?? "").trim();
|
|
523
|
+
if (!chatId || !originSessionId) {
|
|
524
|
+
return { ok: false, reason: "invalid_args" };
|
|
525
|
+
}
|
|
526
|
+
try {
|
|
527
|
+
const existing = await this.store.get(chatId);
|
|
528
|
+
const alreadyLinked = typeof existing?.metadata?.linkedFromSessionId === "string" && existing.metadata.linkedFromSessionId.trim() === originSessionId;
|
|
529
|
+
if (existing) {
|
|
530
|
+
await this.store.update(chatId, {
|
|
531
|
+
metadata: buildGroupSessionMetadata({
|
|
532
|
+
chatId,
|
|
533
|
+
originSessionId,
|
|
534
|
+
base: existing.metadata ?? {}
|
|
535
|
+
})
|
|
536
|
+
});
|
|
537
|
+
if (alreadyLinked) {
|
|
538
|
+
logger.info(`[SessionComponent] attachGroupSession: ${chatId} 已关联 ${originSessionId}(幂等命中,不重复注入)`);
|
|
539
|
+
return { ok: true, sessionId: chatId, injected: false };
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
542
|
+
await this.store.create({
|
|
543
|
+
id: chatId,
|
|
544
|
+
title: args.title ?? `Lark Chat ${chatId}`,
|
|
545
|
+
metadata: buildGroupSessionMetadata({ chatId, originSessionId })
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
const event = buildGroupLinkEventMessage({ originSessionId, chatId });
|
|
549
|
+
await this.store.addMessage(chatId, {
|
|
550
|
+
role: event.role,
|
|
551
|
+
content: event.content
|
|
552
|
+
});
|
|
553
|
+
logger.info(`[SessionComponent] attachGroupSession: ${chatId} ← ${originSessionId}(注入 1 条 user 事件)`);
|
|
554
|
+
return { ok: true, sessionId: chatId, injected: true };
|
|
555
|
+
} catch (err) {
|
|
556
|
+
logger.warn(`[SessionComponent] attachGroupSession(${chatId} ← ${originSessionId}) failed: ${String(err)}`);
|
|
557
|
+
return { ok: false, reason: "store_unavailable", error: String(err) };
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
async detachGroupSession(chatId) {
|
|
561
|
+
if (!this.store)
|
|
562
|
+
return { ok: false, reason: "store_unavailable" };
|
|
563
|
+
const id = (chatId ?? "").trim();
|
|
564
|
+
if (!id)
|
|
565
|
+
return { ok: false, reason: "invalid_args" };
|
|
566
|
+
try {
|
|
567
|
+
const existing = await this.store.get(id);
|
|
568
|
+
if (!existing)
|
|
569
|
+
return { ok: true };
|
|
570
|
+
if (isGroupDisbanded(existing.metadata)) {
|
|
571
|
+
return { ok: true };
|
|
572
|
+
}
|
|
573
|
+
await this.store.update(id, {
|
|
574
|
+
metadata: {
|
|
575
|
+
...existing.metadata ?? {},
|
|
576
|
+
[GROUP_LINK_METADATA_KEYS.groupDisbandedAt]: new Date().toISOString()
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
logger.info(`[SessionComponent] detachGroupSession: ${id} 已标记解散`);
|
|
580
|
+
return { ok: true };
|
|
581
|
+
} catch (err) {
|
|
582
|
+
logger.warn(`[SessionComponent] detachGroupSession(${id}) failed: ${String(err)}`);
|
|
583
|
+
return { ok: false, reason: String(err) };
|
|
584
|
+
}
|
|
585
|
+
}
|
|
434
586
|
chatBindingCache = new Map;
|
|
435
587
|
static CHAT_BINDING_CACHE_TTL_MS = 60000;
|
|
436
588
|
static CHAT_BINDING_CACHE_MAX = 1000;
|
|
@@ -598,7 +750,11 @@ class SessionComponent extends BaseComponent {
|
|
|
598
750
|
return;
|
|
599
751
|
}
|
|
600
752
|
async addMessages(sessionId, messages) {
|
|
601
|
-
|
|
753
|
+
if (!this.store)
|
|
754
|
+
return [];
|
|
755
|
+
if (messages.length === 0)
|
|
756
|
+
return [];
|
|
757
|
+
return this.store.addMessages(sessionId, messages) ?? [];
|
|
602
758
|
}
|
|
603
759
|
async getMessages(sessionId, options) {
|
|
604
760
|
const messages = await this.store?.getMessages(sessionId, options?.offset, options?.limit);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionMessageConverter
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-y6shd91r.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalizeParts
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-aa8kv18f.js";
|
|
7
7
|
import {
|
|
8
8
|
createLogger,
|
|
9
9
|
init_logger
|
|
@@ -641,7 +641,10 @@ class SQLiteSessionStore extends BaseSessionStore {
|
|
|
641
641
|
created_at INTEGER NOT NULL,
|
|
642
642
|
updated_at INTEGER NOT NULL,
|
|
643
643
|
message_count INTEGER DEFAULT 0,
|
|
644
|
-
metadata TEXT
|
|
644
|
+
metadata TEXT,
|
|
645
|
+
-- Task #5403: alias/linkedTo 能力已废弃。列保留只为兼容已有库,
|
|
646
|
+
-- 新代码不读不写(见 types.ts Session.linkedTo 注释)。
|
|
647
|
+
linked_to TEXT
|
|
645
648
|
)
|
|
646
649
|
`);
|
|
647
650
|
this.db.run(`
|
|
@@ -716,8 +719,14 @@ class SQLiteSessionStore extends BaseSessionStore {
|
|
|
716
719
|
const conditions = [];
|
|
717
720
|
if (options?.filter?.metadata) {
|
|
718
721
|
for (const [key, value] of Object.entries(options.filter.metadata)) {
|
|
719
|
-
|
|
720
|
-
|
|
722
|
+
const isScalar = value === null || value === undefined || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
723
|
+
if (isScalar && value !== undefined) {
|
|
724
|
+
conditions.push(`json_extract(metadata, '$.${key}') = ?`);
|
|
725
|
+
params.push(typeof value === "boolean" ? value ? 1 : 0 : value);
|
|
726
|
+
} else {
|
|
727
|
+
conditions.push(`json(json_extract(metadata, '$.${key}')) = json(?)`);
|
|
728
|
+
params.push(value === undefined ? null : JSON.stringify(value));
|
|
729
|
+
}
|
|
721
730
|
}
|
|
722
731
|
}
|
|
723
732
|
if (options?.filter?.startTime) {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
BackgroundTaskManager,
|
|
11
11
|
createDelegateTool
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-0sbmdz8d.js";
|
|
13
13
|
import {
|
|
14
14
|
TaskEntityEventTypes
|
|
15
15
|
} from "./roy-agent-core-8gxth0eh.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
searchTasksTool,
|
|
27
27
|
treeTasksTool,
|
|
28
28
|
updateTaskTool
|
|
29
|
-
} from "./roy-agent-core-
|
|
29
|
+
} from "./roy-agent-core-qwd2dq5q.js";
|
|
30
30
|
import {
|
|
31
31
|
createOperationTool,
|
|
32
32
|
deleteOperationTool,
|
|
@@ -34,10 +34,6 @@ import {
|
|
|
34
34
|
listOperationsTool,
|
|
35
35
|
updateOperationTool
|
|
36
36
|
} from "./roy-agent-core-p5cz9m8v.js";
|
|
37
|
-
import {
|
|
38
|
-
SQLiteTaskStore,
|
|
39
|
-
getDefaultTaskDbPath
|
|
40
|
-
} from "./roy-agent-core-ezvpreqz.js";
|
|
41
37
|
import {
|
|
42
38
|
TaskHookPoints
|
|
43
39
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -51,24 +47,28 @@ import {
|
|
|
51
47
|
TASK_TO_VALIDATE_STATUS_WORD,
|
|
52
48
|
TERMINAL_NON_ACCEPTABLE_STATUSES
|
|
53
49
|
} from "./roy-agent-core-4rtg69cn.js";
|
|
50
|
+
import {
|
|
51
|
+
SQLiteTaskStore,
|
|
52
|
+
getDefaultTaskDbPath
|
|
53
|
+
} from "./roy-agent-core-6k8mb7zx.js";
|
|
54
54
|
import {
|
|
55
55
|
envKeyToConfigKey
|
|
56
56
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
57
57
|
import {
|
|
58
58
|
BaseComponent
|
|
59
|
-
} from "./roy-agent-core-
|
|
59
|
+
} from "./roy-agent-core-m39v7qpx.js";
|
|
60
60
|
import {
|
|
61
61
|
globalHookManager,
|
|
62
62
|
init_global_hook_manager
|
|
63
|
-
} from "./roy-agent-core-
|
|
63
|
+
} from "./roy-agent-core-yet36q5k.js";
|
|
64
64
|
import {
|
|
65
65
|
getEnvContextOrEmpty,
|
|
66
66
|
init_env_context
|
|
67
|
-
} from "./roy-agent-core-
|
|
67
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
68
68
|
import {
|
|
69
69
|
TracedAs,
|
|
70
70
|
init_decorator
|
|
71
|
-
} from "./roy-agent-core-
|
|
71
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
72
72
|
import {
|
|
73
73
|
createLogger,
|
|
74
74
|
init_logger
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
hasDecoratorNodes,
|
|
4
4
|
init_node_registry_helper,
|
|
5
5
|
registerDecoratorNodeType
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-wqs6yypq.js";
|
|
7
7
|
import"./roy-agent-core-1ce3fqrk.js";
|
|
8
8
|
import"./roy-agent-core-ddwa0n6h.js";
|
|
9
|
-
import"./roy-agent-core-
|
|
9
|
+
import"./roy-agent-core-5s2t8z00.js";
|
|
10
10
|
import"./roy-agent-core-7f7t9wwp.js";
|
|
11
11
|
import"./roy-agent-core-85xyctnb.js";
|
|
12
12
|
import"./roy-agent-core-fs0mn2jk.js";
|