@ai-setting/roy-agent-core 1.7.92 → 1.7.94
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/event-source/event-source-handlers.js +5 -5
- package/dist/env/event-source/event-store.js +1 -1
- package/dist/env/event-source/index.js +6 -6
- package/dist/env/index.js +13 -13
- package/dist/env/session/index.js +2 -2
- package/dist/env/session/storage/index.js +1 -1
- package/dist/env/task/delegate/delegate-tool.js +2 -2
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/plugins/index.js +3 -3
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +58 -3
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +130 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +5 -1
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +75 -0
- package/dist/env/task/task-component.d.ts +25 -0
- package/dist/env/workflow/index.js +4 -4
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/storage/index.js +1 -1
- package/dist/env/workflow/tools/index.js +3 -3
- package/dist/index.js +14 -14
- package/dist/shared/@ai-setting/{roy-agent-core-xe03wwy9.js → roy-agent-core-18xsrema.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-wpc432x7.js → roy-agent-core-1gx70hsn.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-3bt71phf.js → roy-agent-core-brw8wp2q.js} +7 -2
- package/dist/shared/@ai-setting/{roy-agent-core-bp1n3z48.js → roy-agent-core-f18s4qgp.js} +7 -2
- package/dist/shared/@ai-setting/{roy-agent-core-45n2r4my.js → roy-agent-core-f2m9yg68.js} +208 -13
- package/dist/shared/@ai-setting/{roy-agent-core-ey945nk5.js → roy-agent-core-h5v1xe9h.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ktphs7sj.js → roy-agent-core-h89whnxz.js} +7 -2
- package/dist/shared/@ai-setting/{roy-agent-core-x36a0g3x.js → roy-agent-core-m4x47ne9.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vevc6pex.js → roy-agent-core-qtb41z61.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-9avt2y0e.js → roy-agent-core-qxnfdjqj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0yzxapfa.js → roy-agent-core-stcr4w4f.js} +150 -5
- package/dist/shared/@ai-setting/{roy-agent-core-74z514eh.js → roy-agent-core-vhgwfmp7.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-f82pd49t.js → roy-agent-core-vw4gv5am.js} +22 -4
- package/dist/shared/@ai-setting/{roy-agent-core-kk2k20a3.js → roy-agent-core-w9qpbpa1.js} +64 -4
- package/dist/shared/@ai-setting/{roy-agent-core-15wktzhv.js → roy-agent-core-xtwnakt8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-v3wm8gyj.js → roy-agent-core-yfxdzysd.js} +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./roy-agent-core-c4ec7k0p.js";
|
|
10
10
|
import {
|
|
11
11
|
getSharedEventStore
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-brw8wp2q.js";
|
|
13
13
|
import {
|
|
14
14
|
WORKFLOW_EXTRACT_PROMPT
|
|
15
15
|
} from "./roy-agent-core-y7fqtzk2.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
createLarkCardStateStore,
|
|
34
34
|
getSharedLarkCardNotifier,
|
|
35
35
|
humanizeValue
|
|
36
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-stcr4w4f.js";
|
|
37
37
|
import {
|
|
38
38
|
RECENT_MESSAGE_LIMIT
|
|
39
39
|
} from "./roy-agent-core-418zc9ha.js";
|
|
@@ -331,11 +331,11 @@ ${prompt}`;
|
|
|
331
331
|
}
|
|
332
332
|
if (!this._workflowRepo) {
|
|
333
333
|
try {
|
|
334
|
-
const sqlite = await import("./roy-agent-core-
|
|
334
|
+
const sqlite = await import("./roy-agent-core-vhgwfmp7.js");
|
|
335
335
|
this.ensureDataDir();
|
|
336
336
|
const db = sqlite.getDatabase();
|
|
337
337
|
sqlite.initializeTables();
|
|
338
|
-
const { WorkflowRepository } = await import("./roy-agent-core-
|
|
338
|
+
const { WorkflowRepository } = await import("./roy-agent-core-qxnfdjqj.js");
|
|
339
339
|
this._workflowRepo = new WorkflowRepository(db);
|
|
340
340
|
return this._workflowRepo;
|
|
341
341
|
} catch {
|
|
@@ -1795,7 +1795,8 @@ var execAsync = promisify(exec);
|
|
|
1795
1795
|
var KNOWN_CARD_ACTIONS = new Set([
|
|
1796
1796
|
"create_group",
|
|
1797
1797
|
"disband_group",
|
|
1798
|
-
"refresh_activity"
|
|
1798
|
+
"refresh_activity",
|
|
1799
|
+
"select_task"
|
|
1799
1800
|
]);
|
|
1800
1801
|
function isCardActionName(v) {
|
|
1801
1802
|
return typeof v === "string" && KNOWN_CARD_ACTIONS.has(v);
|
|
@@ -1803,7 +1804,8 @@ function isCardActionName(v) {
|
|
|
1803
1804
|
var ACTION_SUBJECT_FIELD = {
|
|
1804
1805
|
create_group: "taskId or sessionId",
|
|
1805
1806
|
disband_group: "taskId or sessionId",
|
|
1806
|
-
refresh_activity: "sessionId"
|
|
1807
|
+
refresh_activity: "sessionId",
|
|
1808
|
+
select_task: "taskId or sessionId"
|
|
1807
1809
|
};
|
|
1808
1810
|
function validateCardActionValue(raw) {
|
|
1809
1811
|
const action = raw.action;
|
|
@@ -1844,6 +1846,25 @@ function validateCardActionValue(raw) {
|
|
|
1844
1846
|
error: `Missing required field: ${requiredField} (action=${action})`
|
|
1845
1847
|
};
|
|
1846
1848
|
}
|
|
1849
|
+
if (action === "select_task") {
|
|
1850
|
+
const rawTaskId = raw.taskId;
|
|
1851
|
+
const taskId = typeof rawTaskId === "number" ? rawTaskId : typeof rawTaskId === "string" ? parseInt(rawTaskId, 10) : Number.NaN;
|
|
1852
|
+
if (rawTaskId === undefined || rawTaskId === null || rawTaskId === "") {
|
|
1853
|
+
return {
|
|
1854
|
+
ok: false,
|
|
1855
|
+
action,
|
|
1856
|
+
error: `Missing required field: taskId (action=${action}; sessionId=${sessionId})`
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
if (!Number.isFinite(taskId) || Number.isNaN(taskId) || taskId <= 0) {
|
|
1860
|
+
return {
|
|
1861
|
+
ok: false,
|
|
1862
|
+
action,
|
|
1863
|
+
error: `Invalid taskId: ${String(rawTaskId)} (action=${action})`
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
return { ok: true, action, sessionId, taskId };
|
|
1867
|
+
}
|
|
1847
1868
|
return { ok: true, action, sessionId };
|
|
1848
1869
|
}
|
|
1849
1870
|
function extractTargetSessionId(context) {
|
|
@@ -1923,6 +1944,13 @@ async function handleCardAction(event, ports) {
|
|
|
1923
1944
|
if (validation.action === "refresh_activity") {
|
|
1924
1945
|
return await handleRefreshSessionCard(event, ports);
|
|
1925
1946
|
}
|
|
1947
|
+
if (validation.action === "select_task") {
|
|
1948
|
+
const sel = validation;
|
|
1949
|
+
return await handleSelectTask(event, ports, {
|
|
1950
|
+
sessionId: sel.sessionId,
|
|
1951
|
+
taskId: sel.taskId
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1926
1954
|
const groupValidation = validation;
|
|
1927
1955
|
const action = groupValidation.action;
|
|
1928
1956
|
const taskId = groupValidation.taskId;
|
|
@@ -2292,6 +2320,14 @@ function parseTaskIdLoose(raw) {
|
|
|
2292
2320
|
async function handleRefreshSessionActivity(event, ports, subject) {
|
|
2293
2321
|
const action = "refresh_activity";
|
|
2294
2322
|
const sessionId = subject.sessionId;
|
|
2323
|
+
if (subject.taskId !== undefined && ports.notifier?.isTaskCardMessage?.(event.messageId) && !ports.notifier?.isSessionCardMessage?.(event.messageId)) {
|
|
2324
|
+
logger6.info(`handleRefreshSessionActivity: messageId=${event.messageId} 是 task 卡 ` + `(task #${subject.taskId}),refresh_activity 委托 task 路径(保持卡身份)`);
|
|
2325
|
+
const taskCard = await ports.getTask?.(subject.taskId);
|
|
2326
|
+
if (taskCard) {
|
|
2327
|
+
return await handleRefreshActivity(event, ports, taskCard, subject.taskId);
|
|
2328
|
+
}
|
|
2329
|
+
logger6.warn(`handleRefreshSessionActivity: task #${subject.taskId} 读取失败,` + `refresh_activity 回落 session 路径`);
|
|
2330
|
+
}
|
|
2295
2331
|
let probe;
|
|
2296
2332
|
try {
|
|
2297
2333
|
probe = await ports.loadSessionActivity?.(sessionId);
|
|
@@ -2310,13 +2346,16 @@ async function handleRefreshSessionActivity(event, ports, subject) {
|
|
|
2310
2346
|
logger6.warn(`handleRefreshSessionActivity: loadSessionMessages failed for ${sessionId}: ` + `${err.message}(降级为不渲染最近消息面板)`);
|
|
2311
2347
|
recentMessages = undefined;
|
|
2312
2348
|
}
|
|
2349
|
+
const sessionTaskList = await loadSessionTasksSafe(sessionId, ports);
|
|
2350
|
+
const sessionTasks = sessionTaskList.tasks;
|
|
2313
2351
|
const snapshot = probe?.activity ?? null;
|
|
2314
2352
|
const sessionAlive = probe?.activity !== undefined && !probe?.terminal;
|
|
2315
2353
|
const lifecycle = probe?.lifecycle ? probe.lifecycle : probe?.terminal ? "completed" : sessionAlive ? "running" : taskEnrichment?.lifecycle ?? "running";
|
|
2316
2354
|
const preserved = ports.notifier?.buildSessionCardWithActivity?.(event.messageId, sessionId, snapshot, {
|
|
2317
2355
|
lifecycle,
|
|
2318
2356
|
task: taskEnrichment?.info,
|
|
2319
|
-
...recentMessages !== undefined ? { recentMessages } : {}
|
|
2357
|
+
...recentMessages !== undefined ? { recentMessages } : {},
|
|
2358
|
+
sessionTasks
|
|
2320
2359
|
});
|
|
2321
2360
|
if (preserved) {
|
|
2322
2361
|
logger6.debug(`handleRefreshSessionActivity: ${sessionId} 活性已刷新 ` + `(messageCount=${snapshot?.messageCount ?? "n/a"}, task=${subject.taskId ?? "none"})`);
|
|
@@ -2331,9 +2370,118 @@ async function handleRefreshSessionActivity(event, ports, subject) {
|
|
|
2331
2370
|
sessionId,
|
|
2332
2371
|
activity: snapshot,
|
|
2333
2372
|
lifecycle,
|
|
2373
|
+
...sessionTasks.length > 0 ? { tasks: sessionTasks } : {},
|
|
2374
|
+
...sessionTaskList.total !== undefined ? { taskTotal: sessionTaskList.total } : {},
|
|
2334
2375
|
...taskEnrichment?.info ? { task: taskEnrichment.info } : {},
|
|
2335
2376
|
...groupChat?.chatId ? { perTaskChatId: groupChat.chatId } : {},
|
|
2336
|
-
...recentMessages !== undefined ? { recentMessages } : {}
|
|
2377
|
+
...recentMessages !== undefined ? { recentMessages } : {},
|
|
2378
|
+
...sessionTasks.length > 0 ? { tasks: sessionTasks } : {}
|
|
2379
|
+
})
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
function toTaskSummary(raw) {
|
|
2383
|
+
if (!raw || typeof raw !== "object")
|
|
2384
|
+
return;
|
|
2385
|
+
const r = raw;
|
|
2386
|
+
const id = typeof r.id === "number" ? r.id : typeof r.id === "string" ? parseInt(r.id, 10) : Number.NaN;
|
|
2387
|
+
if (!Number.isFinite(id) || id <= 0)
|
|
2388
|
+
return;
|
|
2389
|
+
const currentStatus = typeof r.currentStatus === "string" ? r.currentStatus : typeof r.current_status === "string" ? r.current_status : undefined;
|
|
2390
|
+
const goals = typeof r.goals === "string" ? r.goals : typeof r.goals_and_expected_deliverables === "string" ? r.goals_and_expected_deliverables : undefined;
|
|
2391
|
+
const parentTaskId = typeof r.parentTaskId === "number" ? r.parentTaskId : typeof r.parent_task_id === "number" && r.parent_task_id > 0 ? r.parent_task_id : undefined;
|
|
2392
|
+
const createdAt = typeof r.createdAt === "string" ? r.createdAt : typeof r.created_at === "string" ? r.created_at : undefined;
|
|
2393
|
+
const updatedAt = typeof r.updatedAt === "string" ? r.updatedAt : typeof r.updated_at === "string" ? r.updated_at : undefined;
|
|
2394
|
+
return {
|
|
2395
|
+
id,
|
|
2396
|
+
...typeof r.title === "string" && r.title ? { title: r.title } : {},
|
|
2397
|
+
...typeof r.status === "string" && r.status ? { status: r.status } : {},
|
|
2398
|
+
...typeof r.progress === "number" ? { progress: r.progress } : {},
|
|
2399
|
+
...currentStatus ? { currentStatus } : {},
|
|
2400
|
+
...typeof r.priority === "string" && r.priority ? { priority: r.priority } : {},
|
|
2401
|
+
...parentTaskId !== undefined ? { parentTaskId } : {},
|
|
2402
|
+
...goals ? { goals } : {},
|
|
2403
|
+
...createdAt ? { createdAt } : {},
|
|
2404
|
+
...updatedAt ? { updatedAt } : {}
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
async function loadSessionTasksSafe(sessionId, ports) {
|
|
2408
|
+
try {
|
|
2409
|
+
const raw = await ports.loadSessionTasks?.(sessionId);
|
|
2410
|
+
const list = Array.isArray(raw) ? raw : raw?.tasks;
|
|
2411
|
+
if (!Array.isArray(list))
|
|
2412
|
+
return { tasks: [] };
|
|
2413
|
+
const tasks = list.map((t) => toTaskSummary(t)).filter((t) => t !== undefined);
|
|
2414
|
+
const total = !Array.isArray(raw) && typeof raw?.total === "number" ? raw.total : undefined;
|
|
2415
|
+
return { tasks, ...total !== undefined ? { total } : {} };
|
|
2416
|
+
} catch (err) {
|
|
2417
|
+
logger6.warn(`loadSessionTasksSafe: ${sessionId} 读取失败(任务列表面板降级为空): ` + `${err.message}`);
|
|
2418
|
+
return { tasks: [] };
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
async function handleSelectTask(event, ports, subject) {
|
|
2422
|
+
const action = "select_task";
|
|
2423
|
+
const { sessionId, taskId } = subject;
|
|
2424
|
+
const taskListResult = await loadSessionTasksSafe(sessionId, ports);
|
|
2425
|
+
const tasks = taskListResult.tasks;
|
|
2426
|
+
if (tasks.length > 0 && !tasks.some((t) => t.id === taskId)) {
|
|
2427
|
+
logger6.warn(`handleSelectTask: task #${taskId} 不属于 ${sessionId}(列表 ${tasks.length} 个)→ 忽略本次切换`);
|
|
2428
|
+
return {
|
|
2429
|
+
ok: false,
|
|
2430
|
+
action,
|
|
2431
|
+
error: `task #${taskId} is not a member of session ${sessionId}`
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
let selectedTask;
|
|
2435
|
+
try {
|
|
2436
|
+
const raw = await ports.getTask?.(taskId);
|
|
2437
|
+
selectedTask = toTaskSummary(raw);
|
|
2438
|
+
} catch (err) {
|
|
2439
|
+
logger6.warn(`handleSelectTask: getTask(${taskId}) 失败(降级为不渲染任务详情): ` + `${err.message}`);
|
|
2440
|
+
selectedTask = undefined;
|
|
2441
|
+
}
|
|
2442
|
+
if (!selectedTask) {
|
|
2443
|
+
selectedTask = tasks.find((t) => t.id === taskId);
|
|
2444
|
+
}
|
|
2445
|
+
let milestones;
|
|
2446
|
+
try {
|
|
2447
|
+
const raw = await ports.loadTaskMilestones?.(taskId);
|
|
2448
|
+
milestones = Array.isArray(raw) ? raw : undefined;
|
|
2449
|
+
} catch (err) {
|
|
2450
|
+
logger6.warn(`handleSelectTask: loadTaskMilestones(${taskId}) 失败(里程碑区降级为空): ` + `${err.message}`);
|
|
2451
|
+
milestones = undefined;
|
|
2452
|
+
}
|
|
2453
|
+
let probe;
|
|
2454
|
+
try {
|
|
2455
|
+
probe = await ports.loadSessionActivity?.(sessionId);
|
|
2456
|
+
} catch (err) {
|
|
2457
|
+
logger6.warn(`handleSelectTask: loadSessionActivity(${sessionId}) 失败(沿用上次快照): ` + `${err.message}`);
|
|
2458
|
+
probe = undefined;
|
|
2459
|
+
}
|
|
2460
|
+
const stateActivity = ports.notifier?.getSessionCardState?.(sessionId)?.activity;
|
|
2461
|
+
const activitySnapshot = probe ? probe.activity ?? null : stateActivity ?? null;
|
|
2462
|
+
const patched = ports.notifier?.buildSessionCardWithActivity?.(event.messageId, sessionId, activitySnapshot, {
|
|
2463
|
+
...probe?.lifecycle ? { lifecycle: probe.lifecycle } : {},
|
|
2464
|
+
sessionTasks: tasks,
|
|
2465
|
+
...taskListResult.total !== undefined ? { taskTotal: taskListResult.total } : {},
|
|
2466
|
+
...selectedTask ? { selectedTask } : {},
|
|
2467
|
+
...milestones !== undefined ? { selectedTaskMilestones: milestones } : {}
|
|
2468
|
+
});
|
|
2469
|
+
if (patched) {
|
|
2470
|
+
logger6.debug(`handleSelectTask: ${sessionId} 切到 task #${taskId}(列表 ${tasks.length} 个任务)`);
|
|
2471
|
+
return { ok: true, action, cardUpdate: patched };
|
|
2472
|
+
}
|
|
2473
|
+
logger6.warn(`handleSelectTask: notifier 无 messageId=${event.messageId} 的状态,fallback 重建 session 卡`);
|
|
2474
|
+
return {
|
|
2475
|
+
ok: true,
|
|
2476
|
+
action,
|
|
2477
|
+
cardUpdate: buildSessionCard({
|
|
2478
|
+
sessionId,
|
|
2479
|
+
tasks,
|
|
2480
|
+
...taskListResult.total !== undefined ? { taskTotal: taskListResult.total } : {},
|
|
2481
|
+
...selectedTask ? { selectedTask } : {},
|
|
2482
|
+
...milestones !== undefined ? { selectedTaskMilestones: milestones } : {},
|
|
2483
|
+
...probe?.activity !== undefined ? { activity: probe.activity } : {},
|
|
2484
|
+
...probe?.lifecycle ? { lifecycle: probe.lifecycle } : {}
|
|
2337
2485
|
})
|
|
2338
2486
|
};
|
|
2339
2487
|
}
|
|
@@ -2600,6 +2748,7 @@ class LarkCliTaskNotifyHook {
|
|
|
2600
2748
|
pluginName;
|
|
2601
2749
|
sourceId;
|
|
2602
2750
|
config;
|
|
2751
|
+
cardNotifyConfigReader;
|
|
2603
2752
|
cardNotifier;
|
|
2604
2753
|
cardMessageIds = new Map;
|
|
2605
2754
|
cardStateStore;
|
|
@@ -2615,6 +2764,9 @@ class LarkCliTaskNotifyHook {
|
|
|
2615
2764
|
this.description = "LarkCli 任务通知 Hook(卡片模式)";
|
|
2616
2765
|
this.pluginName = config.pluginName;
|
|
2617
2766
|
this.sourceId = config.sourceId;
|
|
2767
|
+
if (config.cardNotifyConfigReader) {
|
|
2768
|
+
this.cardNotifyConfigReader = config.cardNotifyConfigReader;
|
|
2769
|
+
}
|
|
2618
2770
|
this.config = {
|
|
2619
2771
|
enabled: true,
|
|
2620
2772
|
priority: 5,
|
|
@@ -2639,6 +2791,17 @@ class LarkCliTaskNotifyHook {
|
|
|
2639
2791
|
hasCardRoutingPorts() {
|
|
2640
2792
|
return this.cardRoutingPorts !== undefined;
|
|
2641
2793
|
}
|
|
2794
|
+
currentEmitTaskCard() {
|
|
2795
|
+
if (this.config.emitTaskCard !== undefined) {
|
|
2796
|
+
return this.config.emitTaskCard !== false;
|
|
2797
|
+
}
|
|
2798
|
+
try {
|
|
2799
|
+
const flags = this.cardNotifyConfigReader?.();
|
|
2800
|
+
if (flags)
|
|
2801
|
+
return flags.emitTaskCard !== false;
|
|
2802
|
+
} catch {}
|
|
2803
|
+
return true;
|
|
2804
|
+
}
|
|
2642
2805
|
async execute(ctx) {
|
|
2643
2806
|
if (!this.config.enabled) {
|
|
2644
2807
|
return;
|
|
@@ -2676,6 +2839,7 @@ class LarkCliTaskNotifyHook {
|
|
|
2676
2839
|
if (!this.isCardModeEnabled())
|
|
2677
2840
|
return;
|
|
2678
2841
|
const sessionId = typeof ctxSessionId === "string" && ctxSessionId.trim() ? ctxSessionId.trim() : this.resolveSessionIdForTask(task.id);
|
|
2842
|
+
const emitTaskCard = this.currentEmitTaskCard();
|
|
2679
2843
|
if (sessionId) {
|
|
2680
2844
|
const merged = await this.patchSessionCardForTask(task, {
|
|
2681
2845
|
sessionId,
|
|
@@ -2689,8 +2853,9 @@ class LarkCliTaskNotifyHook {
|
|
|
2689
2853
|
]
|
|
2690
2854
|
});
|
|
2691
2855
|
if (merged) {
|
|
2692
|
-
logger7.debug(`onAfterCreate: task #${task.id} 已渲染进 session 卡 ${sessionId}
|
|
2693
|
-
|
|
2856
|
+
logger7.debug(`onAfterCreate: task #${task.id} 已渲染进 session 卡 ${sessionId}` + `(${emitTaskCard ? "并存:继续发任务卡片" : "单卡语义:不再发任务卡片"})`);
|
|
2857
|
+
if (!emitTaskCard)
|
|
2858
|
+
return;
|
|
2694
2859
|
}
|
|
2695
2860
|
}
|
|
2696
2861
|
await this.sendCardStart(task);
|
|
@@ -2707,6 +2872,7 @@ class LarkCliTaskNotifyHook {
|
|
|
2707
2872
|
return;
|
|
2708
2873
|
if (!this.isCardModeEnabled())
|
|
2709
2874
|
return;
|
|
2875
|
+
const emitTaskCardTerminal = this.currentEmitTaskCard();
|
|
2710
2876
|
const sessionIdTerminal = this.resolveSessionIdForTask(task.id);
|
|
2711
2877
|
if (sessionIdTerminal) {
|
|
2712
2878
|
const mergedTerminal = await this.patchSessionCardForTask(task, {
|
|
@@ -2720,7 +2886,7 @@ class LarkCliTaskNotifyHook {
|
|
|
2720
2886
|
}
|
|
2721
2887
|
]
|
|
2722
2888
|
});
|
|
2723
|
-
if (mergedTerminal)
|
|
2889
|
+
if (mergedTerminal && !emitTaskCardTerminal)
|
|
2724
2890
|
return;
|
|
2725
2891
|
}
|
|
2726
2892
|
await this.sendCardFinish(task);
|
|
@@ -2738,13 +2904,14 @@ class LarkCliTaskNotifyHook {
|
|
|
2738
2904
|
return;
|
|
2739
2905
|
if (!this.isCardModeEnabled())
|
|
2740
2906
|
return;
|
|
2907
|
+
const emitTaskCardUpdate = this.currentEmitTaskCard();
|
|
2741
2908
|
const sessionIdUpdate = this.resolveSessionIdForTask(task.id);
|
|
2742
2909
|
if (sessionIdUpdate) {
|
|
2743
2910
|
const mergedUpdate = await this.patchSessionCardForTask(task, {
|
|
2744
2911
|
sessionId: sessionIdUpdate,
|
|
2745
2912
|
lifecycle: lifecycleOfTaskStatus(String(task.status)) ?? "running"
|
|
2746
2913
|
});
|
|
2747
|
-
if (mergedUpdate)
|
|
2914
|
+
if (mergedUpdate && !emitTaskCardUpdate)
|
|
2748
2915
|
return;
|
|
2749
2916
|
}
|
|
2750
2917
|
await this.sendCardUpdate(task, changes);
|
|
@@ -2917,7 +3084,9 @@ class LarkCliTaskNotifyHook {
|
|
|
2917
3084
|
if (rec.sessionId) {
|
|
2918
3085
|
this.cardNotifier?.bindTaskToSession?.(taskId, rec.sessionId);
|
|
2919
3086
|
if (rec.messageId) {
|
|
2920
|
-
this.
|
|
3087
|
+
if (!this.currentEmitTaskCard()) {
|
|
3088
|
+
this.cardNotifier?.adoptSessionCard?.(rec.sessionId, rec.messageId);
|
|
3089
|
+
}
|
|
2921
3090
|
}
|
|
2922
3091
|
}
|
|
2923
3092
|
if (!this.restoredTaskIds.has(taskId)) {
|
|
@@ -3485,6 +3654,8 @@ class LarkCliTaskNotifyHook {
|
|
|
3485
3654
|
syncGroupCardFromOriginFn;
|
|
3486
3655
|
recordSessionCardForTask(task, sessionId, chatId, profile, messageIdIn) {
|
|
3487
3656
|
this.cardNotifier?.bindTaskToSession?.(task.id, sessionId);
|
|
3657
|
+
if (this.currentEmitTaskCard())
|
|
3658
|
+
return;
|
|
3488
3659
|
if (!this.cardStateStore)
|
|
3489
3660
|
return;
|
|
3490
3661
|
const messageId = messageIdIn ?? this.cardNotifier?.getSessionCardMessageId?.(sessionId);
|
|
@@ -3578,6 +3749,12 @@ class LarkCliTaskNotifyHook {
|
|
|
3578
3749
|
__legacyDecorateClassTS([
|
|
3579
3750
|
TracedAs("lark-cli-task-notify.execute")
|
|
3580
3751
|
], LarkCliTaskNotifyHook.prototype, "execute", null);
|
|
3752
|
+
__legacyDecorateClassTS([
|
|
3753
|
+
TracedAs("lark-card.restoreState", {
|
|
3754
|
+
recordParams: true,
|
|
3755
|
+
paramFilter: (args) => ({ taskId: args[0] })
|
|
3756
|
+
})
|
|
3757
|
+
], LarkCliTaskNotifyHook.prototype, "restoreCardState", null);
|
|
3581
3758
|
__legacyDecorateClassTS([
|
|
3582
3759
|
TracedAs("lark-cli-task-notify.resolveCardTarget", {
|
|
3583
3760
|
recordParams: true,
|
|
@@ -3595,6 +3772,24 @@ __legacyDecorateClassTS([
|
|
|
3595
3772
|
})
|
|
3596
3773
|
})
|
|
3597
3774
|
], LarkCliTaskNotifyHook.prototype, "resolveCardTarget", null);
|
|
3775
|
+
__legacyDecorateClassTS([
|
|
3776
|
+
TracedAs("lark-card.sendStart", {
|
|
3777
|
+
recordParams: false,
|
|
3778
|
+
paramFilter: (args) => ({ taskId: args[0]?.id, sessionId: args[0]?.sessionId })
|
|
3779
|
+
})
|
|
3780
|
+
], LarkCliTaskNotifyHook.prototype, "sendCardStart", null);
|
|
3781
|
+
__legacyDecorateClassTS([
|
|
3782
|
+
TracedAs("lark-card.patchForTask", {
|
|
3783
|
+
recordParams: true,
|
|
3784
|
+
flattenParamFilter: true,
|
|
3785
|
+
paramFilter: (args) => ({
|
|
3786
|
+
taskId: args[0]?.id,
|
|
3787
|
+
sessionId: args[0]?.sessionId,
|
|
3788
|
+
lifecycle: args[1]?.lifecycle,
|
|
3789
|
+
statusPhrase: args[1]?.statusPhrase
|
|
3790
|
+
})
|
|
3791
|
+
})
|
|
3792
|
+
], LarkCliTaskNotifyHook.prototype, "patchSessionCardForTask", null);
|
|
3598
3793
|
function createLarkCliTaskNotifyHook(config = {}) {
|
|
3599
3794
|
return new LarkCliTaskNotifyHook(config);
|
|
3600
3795
|
}
|
|
@@ -28,9 +28,14 @@ function getDatabaseClass() {
|
|
|
28
28
|
if (typeof Bun !== "undefined") {
|
|
29
29
|
const { Database } = __require("bun:sqlite");
|
|
30
30
|
return Database;
|
|
31
|
-
} else {
|
|
32
|
-
return require_lib();
|
|
33
31
|
}
|
|
32
|
+
try {
|
|
33
|
+
const { DatabaseSync } = __require("node:sqlite");
|
|
34
|
+
if (typeof DatabaseSync === "function") {
|
|
35
|
+
return DatabaseSync;
|
|
36
|
+
}
|
|
37
|
+
} catch {}
|
|
38
|
+
return require_lib();
|
|
34
39
|
}
|
|
35
40
|
function createCompatibleDatabase(path) {
|
|
36
41
|
const Database = getDatabaseClass();
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createWorkflowSearchTool,
|
|
14
14
|
createWorkflowTagListTool,
|
|
15
15
|
createWorkflowValidateTool
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-1gx70hsn.js";
|
|
17
17
|
import {
|
|
18
18
|
WorkflowService
|
|
19
19
|
} from "./roy-agent-core-64ke8s3t.js";
|
|
@@ -163,7 +163,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
163
163
|
if (this.workflowService) {
|
|
164
164
|
this.workflowService = null;
|
|
165
165
|
try {
|
|
166
|
-
const { closeDatabase } = await import("./roy-agent-core-
|
|
166
|
+
const { closeDatabase } = await import("./roy-agent-core-vhgwfmp7.js");
|
|
167
167
|
closeDatabase();
|
|
168
168
|
componentLogger.info("[WorkflowComponent] SQLite database closed");
|
|
169
169
|
} catch (error) {
|
|
@@ -241,8 +241,8 @@ class WorkflowComponent extends BaseComponent {
|
|
|
241
241
|
}
|
|
242
242
|
async initSqliteService() {
|
|
243
243
|
try {
|
|
244
|
-
const { getDatabase, initializeTables } = await import("./roy-agent-core-
|
|
245
|
-
const { WorkflowRepository } = await import("./roy-agent-core-
|
|
244
|
+
const { getDatabase, initializeTables } = await import("./roy-agent-core-vhgwfmp7.js");
|
|
245
|
+
const { WorkflowRepository } = await import("./roy-agent-core-qxnfdjqj.js");
|
|
246
246
|
const { TagRepository } = await import("./roy-agent-core-nn7a0kex.js");
|
|
247
247
|
const db = getDatabase();
|
|
248
248
|
initializeTables();
|
|
@@ -309,7 +309,7 @@ class WorkflowComponent extends BaseComponent {
|
|
|
309
309
|
this.workflowService = null;
|
|
310
310
|
this.nodeRegistry = null;
|
|
311
311
|
try {
|
|
312
|
-
const { closeDatabase } = await import("./roy-agent-core-
|
|
312
|
+
const { closeDatabase } = await import("./roy-agent-core-vhgwfmp7.js");
|
|
313
313
|
closeDatabase();
|
|
314
314
|
} catch {}
|
|
315
315
|
this._status = "stopped";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
WorkflowRepository,
|
|
3
3
|
migrateEmptyTagsToDefault,
|
|
4
4
|
rowToWorkflow
|
|
5
|
-
} from "./roy-agent-core-
|
|
5
|
+
} from "./roy-agent-core-h89whnxz.js";
|
|
6
6
|
import"./roy-agent-core-yqwwebhr.js";
|
|
7
7
|
import"./roy-agent-core-m3vmmvbc.js";
|
|
8
8
|
import"./roy-agent-core-yshw2fvj.js";
|