@ai-setting/roy-agent-core 1.7.85 → 1.7.89
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 +50 -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/backend/index.d.ts +3 -0
- package/dist/env/task/backend/index.js +151 -3
- package/dist/env/task/backend/remote-task-port.d.ts +85 -0
- package/dist/env/task/backend/types.d.ts +5 -0
- 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.d.ts +1 -1
- package/dist/env/task/index.js +34 -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.d.ts +1 -0
- package/dist/env/task/storage/index.js +24 -4
- package/dist/env/task/storage/migrations/006_add_task_owner.d.ts +24 -0
- package/dist/env/task/storage/remote-task-store.d.ts +186 -0
- package/dist/env/task/task-component.d.ts +7 -0
- package/dist/env/task/tools/index.js +4 -4
- package/dist/env/task/tools/task-types.d.ts +7 -0
- package/dist/env/task/types.d.ts +17 -0
- 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.d.ts +1 -1
- package/dist/index.js +71 -60
- package/dist/shared/@ai-setting/{roy-agent-core-q813vafd.js → roy-agent-core-05z35shp.js} +1 -1
- 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-7dd0s3xb.js → roy-agent-core-0n1wwndq.js} +1027 -14
- 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-qk9hd89p.js → roy-agent-core-49qcpqwg.js} +54 -19
- package/dist/shared/@ai-setting/{roy-agent-core-xf6z96qy.js → roy-agent-core-4b38m749.js} +818 -346
- 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-d1n4jbza.js → roy-agent-core-5dhvfgaw.js} +5 -5
- 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-g8htfwxj.js → roy-agent-core-7f10p7m2.js} +1 -1
- 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-vffccgf6.js → roy-agent-core-9cen1jvg.js} +18 -7
- 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-age3qseb.js +177 -0
- 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-p6ks90tb.js → roy-agent-core-dvec4nn2.js} +6 -6
- 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-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-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-b31v3qpv.js → roy-agent-core-k3h8t4q1.js} +992 -212
- 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-ezvpreqz.js → roy-agent-core-m66ysky0.js} +54 -6
- package/dist/shared/@ai-setting/{roy-agent-core-begm7ytz.js → roy-agent-core-m7d1t3db.js} +3 -3
- 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-1v4g0d4x.js → roy-agent-core-rm7seqwb.js} +1 -1
- 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-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-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-zhwcje5a.js +352 -0
- package/package.json +9 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createAutoTaskPlugin,
|
|
3
3
|
createLayaDecisionPlugin,
|
|
4
4
|
registerLayaCompletionTaskHook
|
|
5
|
-
} from "./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-k3h8t4q1.js";
|
|
6
6
|
import {
|
|
7
7
|
TaskHookPoints
|
|
8
8
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -12,24 +12,24 @@ import {
|
|
|
12
12
|
} from "./roy-agent-core-ctdhjv68.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseComponent
|
|
15
|
-
} from "./roy-agent-core-
|
|
15
|
+
} from "./roy-agent-core-m39v7qpx.js";
|
|
16
16
|
import {
|
|
17
17
|
init_hook
|
|
18
|
-
} from "./roy-agent-core-
|
|
18
|
+
} from "./roy-agent-core-smf94h73.js";
|
|
19
19
|
import {
|
|
20
20
|
init_context
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-tkpp1ba0.js";
|
|
22
22
|
import {
|
|
23
23
|
getEnvContext,
|
|
24
24
|
init_env_context,
|
|
25
25
|
runWithEnvContextAsync
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
27
27
|
import {
|
|
28
28
|
TracedAs,
|
|
29
29
|
envQueryParamFilter,
|
|
30
30
|
init_decorator,
|
|
31
31
|
init_trace_filters
|
|
32
|
-
} from "./roy-agent-core-
|
|
32
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
33
33
|
import {
|
|
34
34
|
createLogger,
|
|
35
35
|
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";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildWecomSendCardFrame
|
|
3
|
+
} from "./roy-agent-core-c4ec7k0p.js";
|
|
1
4
|
import {
|
|
2
5
|
getEnvContextOrEmpty,
|
|
3
6
|
init_env_context
|
|
4
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-p31ftgq9.js";
|
|
5
8
|
|
|
6
9
|
// src/env/event-source/wecom-respond-registry.ts
|
|
7
10
|
init_env_context();
|
|
@@ -142,205 +145,6 @@ async function sendWecomCliMarkdown(input) {
|
|
|
142
145
|
return { ok: false, error: `${detail} (exit=${code ?? "null"})` };
|
|
143
146
|
}
|
|
144
147
|
|
|
145
|
-
// src/env/event-source/wecom-card-builder.ts
|
|
146
|
-
var WecomCardActionKey = {
|
|
147
|
-
VIEW: "task_view",
|
|
148
|
-
MARK_DONE: "task_mark_done",
|
|
149
|
-
REOPEN: "task_reopen"
|
|
150
|
-
};
|
|
151
|
-
function wecomCardTaskIdForTask(taskId) {
|
|
152
|
-
return `roy-task-${taskId}`;
|
|
153
|
-
}
|
|
154
|
-
var cardSeq = 0;
|
|
155
|
-
function newWecomCardTaskId(taskId) {
|
|
156
|
-
cardSeq = (cardSeq + 1) % 1e6;
|
|
157
|
-
const rand = Math.random().toString(36).slice(2, 8);
|
|
158
|
-
return `${wecomCardTaskIdForTask(taskId)}-${cardSeq}-${rand}`;
|
|
159
|
-
}
|
|
160
|
-
function formatTs(iso) {
|
|
161
|
-
try {
|
|
162
|
-
const d = new Date(iso);
|
|
163
|
-
if (isNaN(d.getTime()))
|
|
164
|
-
return iso;
|
|
165
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
166
|
-
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ` + `${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
167
|
-
} catch {
|
|
168
|
-
return iso;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function clip(text, max) {
|
|
172
|
-
if (!text)
|
|
173
|
-
return "";
|
|
174
|
-
const t = text.trim();
|
|
175
|
-
return t.length > max ? `${t.slice(0, max)}…` : t;
|
|
176
|
-
}
|
|
177
|
-
function shortMilestoneValue(text) {
|
|
178
|
-
if (!text)
|
|
179
|
-
return "";
|
|
180
|
-
const t = text.trim();
|
|
181
|
-
const colonIdx = t.indexOf(":");
|
|
182
|
-
const head = colonIdx > 0 && colonIdx <= 20 ? t.slice(0, colonIdx).trim() : t;
|
|
183
|
-
if (head.length <= MAX_HORIZONTAL_VALUE)
|
|
184
|
-
return head;
|
|
185
|
-
return clipWord(head, MAX_HORIZONTAL_VALUE);
|
|
186
|
-
}
|
|
187
|
-
function clipWord(text, max) {
|
|
188
|
-
if (!text)
|
|
189
|
-
return "";
|
|
190
|
-
const t = text.trim();
|
|
191
|
-
if (t.length <= max)
|
|
192
|
-
return t;
|
|
193
|
-
let cut = t.slice(0, max - 1);
|
|
194
|
-
const lastSpace = cut.lastIndexOf(" ");
|
|
195
|
-
if (lastSpace > max * 0.4)
|
|
196
|
-
return `${cut.slice(0, lastSpace).trimEnd()}…`;
|
|
197
|
-
const cjkBoundary = findCjkAsciiBoundary(cut);
|
|
198
|
-
if (cjkBoundary > max * 0.4)
|
|
199
|
-
return `${cut.slice(0, cjkBoundary).trimEnd()}…`;
|
|
200
|
-
return cut.slice(0, max - 1);
|
|
201
|
-
}
|
|
202
|
-
function findCjkAsciiBoundary(text) {
|
|
203
|
-
const isCjk = (ch) => /[一-鿿-ヿ가-]/.test(ch);
|
|
204
|
-
const isAsciiAlnum = (ch) => /[A-Za-z0-9]/.test(ch);
|
|
205
|
-
for (let i = text.length - 1;i > 0; i--) {
|
|
206
|
-
const prev = text[i - 1];
|
|
207
|
-
const cur = text[i];
|
|
208
|
-
if (isCjk(prev) !== isAsciiAlnum(cur) && isCjk(cur) !== isAsciiAlnum(prev)) {
|
|
209
|
-
if (isCjk(prev) && isAsciiAlnum(cur) || isAsciiAlnum(prev) && isCjk(cur)) {
|
|
210
|
-
return i;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return -1;
|
|
215
|
-
}
|
|
216
|
-
var MAX_TIMELINE_LINES = 8;
|
|
217
|
-
var MAX_HORIZONTAL_ROWS = 6;
|
|
218
|
-
var MAX_HORIZONTAL_VALUE = 26;
|
|
219
|
-
function buildWecomTextNoticeCard(input) {
|
|
220
|
-
const progressPct = `${Math.max(0, Math.min(100, Math.round(input.progress ?? 0)))}%`;
|
|
221
|
-
const sorted = [...input.milestones].slice(-MAX_TIMELINE_LINES).reverse();
|
|
222
|
-
const timelineRows = sorted.slice(0, MAX_HORIZONTAL_ROWS - 1).map((m) => ({
|
|
223
|
-
keyname: formatTs(m.timestamp).slice(11),
|
|
224
|
-
value: shortMilestoneValue(m.title)
|
|
225
|
-
}));
|
|
226
|
-
const horizontal = [
|
|
227
|
-
{ keyname: "状态", value: clip(input.statusLabel, MAX_HORIZONTAL_VALUE) },
|
|
228
|
-
...timelineRows
|
|
229
|
-
];
|
|
230
|
-
const latest = sorted[0];
|
|
231
|
-
const quoteLine = latest ? `${formatTs(latest.timestamp)} — ${clipWord(latest.title, 80)}${latest.description ? `:${clipWord(latest.description, 80)}` : ""}` : "";
|
|
232
|
-
const latestSummary = latest && latest.title ? `${formatTs(latest.timestamp)} ${clip(latest.title, 140)}` : undefined;
|
|
233
|
-
const subTitle = input.terminal ? `任务${input.statusLabel.replace(/^[^\u4e00-\u9fa5A-Za-z]*/, "")} · 详见会话` : latestSummary;
|
|
234
|
-
return {
|
|
235
|
-
card_type: "text_notice",
|
|
236
|
-
main_title: {
|
|
237
|
-
title: `\uD83D\uDCCB Task #${input.taskId} · ${clip(input.title, 60)}`,
|
|
238
|
-
desc: clip(input.description, 80) || undefined
|
|
239
|
-
},
|
|
240
|
-
emphasis_content: {
|
|
241
|
-
title: progressPct,
|
|
242
|
-
desc: "进度"
|
|
243
|
-
},
|
|
244
|
-
sub_title_text: subTitle,
|
|
245
|
-
horizontal_content_list: horizontal,
|
|
246
|
-
quote_area: {
|
|
247
|
-
type: 0,
|
|
248
|
-
title: "最新进展",
|
|
249
|
-
quote_text: quoteLine || "(暂无操作记录)"
|
|
250
|
-
},
|
|
251
|
-
card_action: { type: 0 }
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
var MAX_BUTTONS = 6;
|
|
255
|
-
var MAX_BUTTON_TEXT = 10;
|
|
256
|
-
function buildWecomButtonInteractionCard(input) {
|
|
257
|
-
const notice = buildWecomTextNoticeCard({
|
|
258
|
-
taskId: input.taskId,
|
|
259
|
-
title: input.title,
|
|
260
|
-
statusLabel: input.statusLabel,
|
|
261
|
-
progress: input.progress,
|
|
262
|
-
description: input.description,
|
|
263
|
-
changeSummary: input.changeSummary,
|
|
264
|
-
milestones: input.milestones ?? []
|
|
265
|
-
});
|
|
266
|
-
const buttons = (input.buttons ?? []).slice(0, MAX_BUTTONS).map((b) => ({
|
|
267
|
-
text: clip(b.text, MAX_BUTTON_TEXT),
|
|
268
|
-
style: b.style ?? 1,
|
|
269
|
-
key: b.key
|
|
270
|
-
}));
|
|
271
|
-
return {
|
|
272
|
-
card_type: "button_interaction",
|
|
273
|
-
main_title: notice.main_title,
|
|
274
|
-
sub_title_text: notice.sub_title_text,
|
|
275
|
-
horizontal_content_list: notice.horizontal_content_list,
|
|
276
|
-
quote_area: notice.quote_area,
|
|
277
|
-
button_list: buttons,
|
|
278
|
-
card_action: { type: 0 },
|
|
279
|
-
task_id: input.cardTaskId ?? newWecomCardTaskId(input.taskId)
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
function buildWecomSendCardFrame(input) {
|
|
283
|
-
const reqId = input.reqId && input.reqId.trim() ? input.reqId.trim() : `aibot_send_msg_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
284
|
-
return {
|
|
285
|
-
cmd: "aibot_send_msg",
|
|
286
|
-
headers: { req_id: reqId },
|
|
287
|
-
body: {
|
|
288
|
-
chatid: input.chatId,
|
|
289
|
-
chat_type: input.chatType === "group" ? 2 : 1,
|
|
290
|
-
msgtype: "template_card",
|
|
291
|
-
template_card: input.card
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
var MAX_UPDATE_TITLE = 60;
|
|
296
|
-
function buildUpdateMainTitle(statusLabel, taskNumber, taskTitle) {
|
|
297
|
-
const segments = [];
|
|
298
|
-
if (taskNumber !== undefined && Number.isFinite(taskNumber)) {
|
|
299
|
-
segments.push(`Task #${taskNumber}`);
|
|
300
|
-
}
|
|
301
|
-
if (taskTitle) {
|
|
302
|
-
segments.push(clip(taskTitle, MAX_UPDATE_TITLE));
|
|
303
|
-
}
|
|
304
|
-
segments.push(statusLabel);
|
|
305
|
-
return segments.length > 1 ? `\uD83D\uDCCB ${segments.join(" · ")}` : `\uD83D\uDCCB ${statusLabel}`;
|
|
306
|
-
}
|
|
307
|
-
function buildWecomCardUpdateFrame(input) {
|
|
308
|
-
const reqId = (input.reqId ?? "").trim();
|
|
309
|
-
if (!reqId) {
|
|
310
|
-
throw new Error("buildWecomCardUpdateFrame: req_id is required " + "(update must reference the template_card_event frame)");
|
|
311
|
-
}
|
|
312
|
-
const buttons = (input.buttonOverrides ?? []).slice(0, MAX_BUTTONS).map((b) => ({
|
|
313
|
-
text: clip(b.text, MAX_BUTTON_TEXT),
|
|
314
|
-
style: b.style ?? 1,
|
|
315
|
-
key: b.key
|
|
316
|
-
}));
|
|
317
|
-
const sorted = [...input.timeline ?? []].reverse();
|
|
318
|
-
const timelineRows = sorted.slice(0, MAX_HORIZONTAL_ROWS).map((m) => ({
|
|
319
|
-
keyname: formatTs(m.timestamp).slice(11),
|
|
320
|
-
value: shortMilestoneValue(m.title)
|
|
321
|
-
}));
|
|
322
|
-
const total = sorted.length;
|
|
323
|
-
const subTitle = total > 0 ? total > MAX_HORIZONTAL_ROWS ? `共 ${total} 条操作记录,显示最近 ${MAX_HORIZONTAL_ROWS} 条(最新在顶部)` : `共 ${total} 条操作记录(最新在顶部)` : undefined;
|
|
324
|
-
return {
|
|
325
|
-
cmd: "aibot_respond_update_msg",
|
|
326
|
-
headers: { req_id: reqId },
|
|
327
|
-
body: {
|
|
328
|
-
response_type: "update_template_card",
|
|
329
|
-
template_card: {
|
|
330
|
-
card_type: "button_interaction",
|
|
331
|
-
main_title: {
|
|
332
|
-
title: buildUpdateMainTitle(input.statusLabel, input.taskNumber, input.taskTitle),
|
|
333
|
-
desc: input.note ? clip(input.note, 80) : undefined
|
|
334
|
-
},
|
|
335
|
-
sub_title_text: subTitle,
|
|
336
|
-
horizontal_content_list: timelineRows,
|
|
337
|
-
button_list: buttons,
|
|
338
|
-
task_id: String(input.taskId)
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
148
|
// src/env/event-source/wecom-respond-registry.ts
|
|
345
149
|
var registry = new Map;
|
|
346
150
|
function registerWecomRespondTarget(sourceId, target) {
|
|
@@ -437,7 +241,8 @@ var wecomRespondTool = {
|
|
|
437
241
|
metadata: {
|
|
438
242
|
category: "messaging",
|
|
439
243
|
tags: ["wecom", "reply", "im"],
|
|
440
|
-
version: "2.0.0"
|
|
244
|
+
version: "2.0.0",
|
|
245
|
+
channelOnly: true
|
|
441
246
|
},
|
|
442
247
|
execute: async (args, _ctx) => {
|
|
443
248
|
const { content } = args;
|
|
@@ -454,6 +259,37 @@ var wecomRespondTool = {
|
|
|
454
259
|
const rid = meta?.reqId;
|
|
455
260
|
if (typeof rid === "string" && rid.length > 0)
|
|
456
261
|
eventReqId = rid;
|
|
262
|
+
if (!eventChatId) {
|
|
263
|
+
const rcChatId = ctx.replyChannel?.chatId;
|
|
264
|
+
if (typeof rcChatId === "string" && rcChatId.length > 0) {
|
|
265
|
+
eventChatId = rcChatId;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const rc = meta?.replyChannel;
|
|
269
|
+
if (!eventChatId && typeof rc?.chatId === "string" && rc.chatId) {
|
|
270
|
+
eventChatId = rc.chatId;
|
|
271
|
+
}
|
|
272
|
+
const rcParamsList = [
|
|
273
|
+
rc?.params,
|
|
274
|
+
ctx.replyChannel?.params
|
|
275
|
+
];
|
|
276
|
+
for (const rcParams of rcParamsList) {
|
|
277
|
+
if (!rcParams)
|
|
278
|
+
continue;
|
|
279
|
+
if (!eventReqId) {
|
|
280
|
+
const prid = rcParams.reqId;
|
|
281
|
+
if (typeof prid === "string" && prid.length > 0)
|
|
282
|
+
eventReqId = prid;
|
|
283
|
+
}
|
|
284
|
+
if (!sourceId) {
|
|
285
|
+
const psid = rcParams.sourceId;
|
|
286
|
+
if (typeof psid === "string" && psid.length > 0)
|
|
287
|
+
sourceId = psid;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (!sourceId && typeof ctx?.sourceId === "string" && ctx.sourceId) {
|
|
291
|
+
sourceId = ctx.sourceId;
|
|
292
|
+
}
|
|
457
293
|
} catch {}
|
|
458
294
|
const chatId = args.chat_id?.trim() || eventChatId;
|
|
459
295
|
const reqId = args.req_id?.trim() || eventReqId;
|
|
@@ -541,4 +377,4 @@ async function autoReplyWecomTurn(envEvent, finalText) {
|
|
|
541
377
|
return { skipped: false, ok: r.ok, channel: r.channel, error: r.error };
|
|
542
378
|
}
|
|
543
379
|
|
|
544
|
-
export {
|
|
380
|
+
export { sendWecomCliMarkdown, registerWecomRespondTarget, unregisterWecomRespondTarget, getWecomRespondTarget, __resetWecomRespondRegistryForTest, sendWecomReply, sendWecomTemplateCard, wecomRespondTool, markWecomReplySent, wasWecomReplySent, __resetWecomReplySentForTest, autoReplyWecomTurn };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_hook
|
|
3
|
-
} from "./roy-agent-core-
|
|
3
|
+
} from "./roy-agent-core-smf94h73.js";
|
|
4
4
|
import {
|
|
5
5
|
globalHookManager
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-yet36q5k.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./roy-agent-core-fs0mn2jk.js";
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
} from "./roy-agent-core-fttgm52a.js";
|
|
12
12
|
import {
|
|
13
13
|
wecomRespondTool
|
|
14
|
-
} from "./roy-agent-core-
|
|
14
|
+
} from "./roy-agent-core-h1e1fm9b.js";
|
|
15
15
|
import {
|
|
16
16
|
init_decorator,
|
|
17
17
|
init_trace_filters,
|
|
18
18
|
toolExecResultFilter,
|
|
19
19
|
toolInvokeParamFilter,
|
|
20
20
|
wrapFunction
|
|
21
|
-
} from "./roy-agent-core-
|
|
21
|
+
} from "./roy-agent-core-5s2t8z00.js";
|
|
22
22
|
import {
|
|
23
23
|
createLogger,
|
|
24
24
|
exports_tracer_provider,
|