@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.
Files changed (37) hide show
  1. package/dist/env/event-source/event-source-handlers.js +5 -5
  2. package/dist/env/event-source/event-store.js +1 -1
  3. package/dist/env/event-source/index.js +6 -6
  4. package/dist/env/index.js +13 -13
  5. package/dist/env/session/index.js +2 -2
  6. package/dist/env/session/storage/index.js +1 -1
  7. package/dist/env/task/delegate/delegate-tool.js +2 -2
  8. package/dist/env/task/delegate/index.js +2 -2
  9. package/dist/env/task/index.js +3 -3
  10. package/dist/env/task/plugins/index.js +3 -3
  11. package/dist/env/task/plugins/lark-card-action-handler.d.ts +58 -3
  12. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +130 -0
  13. package/dist/env/task/plugins/lark-card-patch-notifier.js +5 -1
  14. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +75 -0
  15. package/dist/env/task/task-component.d.ts +25 -0
  16. package/dist/env/workflow/index.js +4 -4
  17. package/dist/env/workflow/plugins/index.js +2 -2
  18. package/dist/env/workflow/storage/index.js +1 -1
  19. package/dist/env/workflow/tools/index.js +3 -3
  20. package/dist/index.js +14 -14
  21. package/dist/shared/@ai-setting/{roy-agent-core-xe03wwy9.js → roy-agent-core-18xsrema.js} +1 -1
  22. package/dist/shared/@ai-setting/{roy-agent-core-wpc432x7.js → roy-agent-core-1gx70hsn.js} +1 -1
  23. package/dist/shared/@ai-setting/{roy-agent-core-3bt71phf.js → roy-agent-core-brw8wp2q.js} +7 -2
  24. package/dist/shared/@ai-setting/{roy-agent-core-bp1n3z48.js → roy-agent-core-f18s4qgp.js} +7 -2
  25. package/dist/shared/@ai-setting/{roy-agent-core-45n2r4my.js → roy-agent-core-f2m9yg68.js} +208 -13
  26. package/dist/shared/@ai-setting/{roy-agent-core-ey945nk5.js → roy-agent-core-h5v1xe9h.js} +1 -1
  27. package/dist/shared/@ai-setting/{roy-agent-core-ktphs7sj.js → roy-agent-core-h89whnxz.js} +7 -2
  28. package/dist/shared/@ai-setting/{roy-agent-core-x36a0g3x.js → roy-agent-core-m4x47ne9.js} +1 -1
  29. package/dist/shared/@ai-setting/{roy-agent-core-vevc6pex.js → roy-agent-core-qtb41z61.js} +5 -5
  30. package/dist/shared/@ai-setting/{roy-agent-core-9avt2y0e.js → roy-agent-core-qxnfdjqj.js} +1 -1
  31. package/dist/shared/@ai-setting/{roy-agent-core-0yzxapfa.js → roy-agent-core-stcr4w4f.js} +150 -5
  32. package/dist/shared/@ai-setting/{roy-agent-core-74z514eh.js → roy-agent-core-vhgwfmp7.js} +1 -1
  33. package/dist/shared/@ai-setting/{roy-agent-core-f82pd49t.js → roy-agent-core-vw4gv5am.js} +22 -4
  34. package/dist/shared/@ai-setting/{roy-agent-core-kk2k20a3.js → roy-agent-core-w9qpbpa1.js} +64 -4
  35. package/dist/shared/@ai-setting/{roy-agent-core-15wktzhv.js → roy-agent-core-xtwnakt8.js} +1 -1
  36. package/dist/shared/@ai-setting/{roy-agent-core-v3wm8gyj.js → roy-agent-core-yfxdzysd.js} +1 -1
  37. package/package.json +1 -1
@@ -637,6 +637,47 @@ function renderProcessSteps(steps) {
637
637
  }).join(`
638
638
  `);
639
639
  }
640
+ var SESSION_TASK_LIST_MAX = 5;
641
+ function renderSessionTaskList(sessionId, tasks, taskTotal) {
642
+ const known = tasks.length;
643
+ const total = typeof taskTotal === "number" && taskTotal > known ? taskTotal : known;
644
+ const truncated = total > SESSION_TASK_LIST_MAX;
645
+ const recentFirst = [...tasks].sort((a, b) => b.id - a.id);
646
+ const ordered = recentFirst.slice(0, SESSION_TASK_LIST_MAX);
647
+ const title = truncated ? `\uD83D\uDCCB 任务列表(共 ${total} 个任务,最近 ${SESSION_TASK_LIST_MAX} 个)` : `\uD83D\uDCCB 任务列表(${total})`;
648
+ const elements = [];
649
+ if (truncated) {
650
+ elements.push({
651
+ tag: "markdown",
652
+ content: `**共 ${total} 个任务,最近 ${SESSION_TASK_LIST_MAX} 个:**`
653
+ });
654
+ }
655
+ for (const t of ordered) {
656
+ const label = t.title ? `#${t.id} ${t.title}` : `#${t.id}`;
657
+ elements.push({
658
+ tag: "button",
659
+ text: {
660
+ tag: "plain_text",
661
+ content: `▶ ${sanitizeInlineText(label, 40)}`
662
+ },
663
+ type: "default",
664
+ value: {
665
+ action: "select_task",
666
+ sessionId,
667
+ taskId: String(t.id)
668
+ }
669
+ });
670
+ const meta = [];
671
+ if (t.status)
672
+ meta.push(`\uD83D\uDEA6 ${sanitizeInlineText(t.status, 20)}`);
673
+ if (typeof t.progress === "number")
674
+ meta.push(`\uD83D\uDCCA ${Math.round(t.progress)}%`);
675
+ if (meta.length > 0) {
676
+ elements.push({ tag: "markdown", content: `  ${meta.join(" · ")}` });
677
+ }
678
+ }
679
+ return { title, elements };
680
+ }
640
681
  function milestoneKey(m) {
641
682
  return `${m.title}|${m.timestamp ?? ""}|${m.description ?? ""}`;
642
683
  }
@@ -796,7 +837,7 @@ function buildTaskCard(opts) {
796
837
  return {
797
838
  schema: "2.0",
798
839
  header: {
799
- title: { tag: "plain_text", content: `\uD83D\uDCCA Task 实时更新(${taskLabel})` },
840
+ title: { tag: "plain_text", content: `\uD83D\uDCCB 任务卡实时更新(${taskLabel})` },
800
841
  subtitle: {
801
842
  tag: "plain_text",
802
843
  content: `spinner: '${spinner}' · 第 ${updateCount} 次更新 | ` + STATUS_PHRASE[status]
@@ -865,7 +906,8 @@ function buildSessionCard(opts) {
865
906
  appendHr(elements);
866
907
  }
867
908
  const taskInfo = opts.task;
868
- if (taskInfo) {
909
+ const selectedDuplicatesBoundTask = taskInfo !== undefined && opts.selectedTask !== undefined && Number(opts.selectedTask.id) === Number(taskInfo.id);
910
+ if (taskInfo && !selectedDuplicatesBoundTask) {
869
911
  const taskLines = [];
870
912
  taskLines.push(`- **\uD83C\uDD94 任务 ID**:#${taskInfo.id}`);
871
913
  if (taskInfo.title) {
@@ -914,6 +956,39 @@ function buildSessionCard(opts) {
914
956
  appendHr(elements);
915
957
  }
916
958
  }
959
+ const taskList = opts.tasks ?? [];
960
+ if (taskList.length > 0) {
961
+ const listResult = renderSessionTaskList(opts.sessionId, taskList, opts.taskTotal);
962
+ elements.push(buildCollapsiblePanel({
963
+ title: listResult.title,
964
+ elementId: "session_task_list",
965
+ expanded: true,
966
+ elements: listResult.elements
967
+ }));
968
+ appendHr(elements);
969
+ }
970
+ if (opts.selectedTask) {
971
+ const sel = opts.selectedTask;
972
+ const selLines = [];
973
+ selLines.push(`- **\uD83C\uDD94 任务 ID**:#${sel.id}`);
974
+ if (sel.title)
975
+ selLines.push(`- **\uD83D\uDCCC 标题**:${sanitizeInlineText(sel.title, 120)}`);
976
+ if (sel.status)
977
+ selLines.push(`- **\uD83D\uDEA6 状态**:${sanitizeInlineText(sel.status, 40)}`);
978
+ if (typeof sel.progress === "number") {
979
+ selLines.push(`- **\uD83D\uDCCA 进度**:${renderProgressBar(sel.progress)}`);
980
+ }
981
+ if (sel.currentStatus) {
982
+ selLines.push(`- **\uD83D\uDCDD 当前状态**:${sanitizeInlineText(sel.currentStatus, 200)}`);
983
+ }
984
+ elements.push(buildCollapsiblePanel({
985
+ title: "\uD83D\uDCCB 任务信息",
986
+ elementId: "session_selected_task_detail",
987
+ elements: [{ tag: "markdown", content: selLines.join(`
988
+ `) }]
989
+ }));
990
+ appendHr(elements);
991
+ }
917
992
  if (opts.activity !== undefined) {
918
993
  elements.push(buildCollapsiblePanel({
919
994
  title: "⚡ 子会话活性",
@@ -953,6 +1028,21 @@ function buildSessionCard(opts) {
953
1028
  elements: [{ tag: "markdown", content: renderMilestones(milestones) }]
954
1029
  }));
955
1030
  }
1031
+ if (opts.selectedTask) {
1032
+ const selMilestones = opts.selectedTaskMilestones ?? [];
1033
+ elements.push(buildCollapsiblePanel({
1034
+ title: `\uD83D\uDCCC 任务里程碑(#${opts.selectedTask.id},${selMilestones.length})`,
1035
+ elementId: "session_task_milestones",
1036
+ expanded: selMilestones.length > 0,
1037
+ elements: [
1038
+ {
1039
+ tag: "markdown",
1040
+ content: selMilestones.length > 0 ? renderMilestones(selMilestones) : "(该任务暂无里程碑)"
1041
+ }
1042
+ ]
1043
+ }));
1044
+ appendHr(elements);
1045
+ }
956
1046
  const titleRaw = opts.title?.trim();
957
1047
  const headLabel = titleRaw ? truncateHeadTitle(titleRaw) : truncateHeadTitle(sessionId);
958
1048
  const lifecycle = opts.lifecycle ?? "running";
@@ -961,7 +1051,7 @@ function buildSessionCard(opts) {
961
1051
  return {
962
1052
  schema: "2.0",
963
1053
  header: {
964
- title: { tag: "plain_text", content: `\uD83D\uDCCA 子会话实时更新(${headLabel})` },
1054
+ title: { tag: "plain_text", content: `\uD83D\uDCAC 会话卡实时更新(${headLabel})` },
965
1055
  subtitle: {
966
1056
  tag: "plain_text",
967
1057
  content: `spinner: '${spinner}' · 第 ${updateCount} 次更新 | ${lifecyclePhrase}`
@@ -1159,6 +1249,7 @@ class LarkCardPatchNotifier {
1159
1249
  unpinOnFinish: false,
1160
1250
  ...(({ sessionCardStore: _scs, ...rest }) => rest)(options)
1161
1251
  };
1252
+ this.restoreSessionCardsFromStore();
1162
1253
  }
1163
1254
  mutexFor(messageId) {
1164
1255
  let m = this.mutexes.get(messageId);
@@ -1520,6 +1611,7 @@ class LarkCardPatchNotifier {
1520
1611
  ...opts.activity !== undefined ? { activity: opts.activity } : state.activity !== undefined ? { activity: state.activity } : {},
1521
1612
  ...opts.task !== undefined ? { task: opts.task } : state.task !== undefined ? { task: state.task } : {},
1522
1613
  ...opts.recentMessages !== undefined ? { recentMessages: opts.recentMessages } : state.recentMessages !== undefined ? { recentMessages: state.recentMessages } : {},
1614
+ ...opts.tasks !== undefined ? { tasks: opts.tasks, taskTotal: opts.tasks.length } : state.sessionTasks !== undefined ? { tasks: state.sessionTasks } : {},
1523
1615
  ...opts.perTaskChatId ?? state.perTaskChatId ? { perTaskChatId: opts.perTaskChatId ?? state.perTaskChatId } : {},
1524
1616
  ...opts.perTaskChatName ?? state.perTaskChatName ? { perTaskChatName: opts.perTaskChatName ?? state.perTaskChatName } : {}
1525
1617
  });
@@ -1535,6 +1627,7 @@ class LarkCardPatchNotifier {
1535
1627
  lifecycle: opts.lifecycle,
1536
1628
  ...opts.activity !== undefined ? { activity: opts.activity } : {},
1537
1629
  ...opts.task !== undefined ? { task: opts.task } : {},
1630
+ ...opts.tasks !== undefined ? { sessionTasks: opts.tasks, taskTotal: opts.tasks.length } : {},
1538
1631
  ...opts.perTaskChatId ? { perTaskChatId: opts.perTaskChatId } : {},
1539
1632
  ...opts.perTaskChatName ? { perTaskChatName: opts.perTaskChatName } : {}
1540
1633
  });
@@ -1558,6 +1651,9 @@ class LarkCardPatchNotifier {
1558
1651
  isSessionCardMessage(messageId) {
1559
1652
  return this.sessionStates.has(messageId);
1560
1653
  }
1654
+ isTaskCardMessage(messageId) {
1655
+ return this.states.has(messageId) || this.finalisedCards.has(messageId);
1656
+ }
1561
1657
  applyTaskEventToSessionCard(messageId, delta) {
1562
1658
  const state = this.sessionStates.get(messageId);
1563
1659
  if (!state) {
@@ -1787,6 +1883,7 @@ class LarkCardPatchNotifier {
1787
1883
  updateCount: 1,
1788
1884
  ...opts.activity !== undefined ? { activity: opts.activity } : {},
1789
1885
  ...opts.task !== undefined ? { task: opts.task } : {},
1886
+ ...opts.tasks !== undefined ? { tasks: opts.tasks, taskTotal: opts.tasks.length } : {},
1790
1887
  ...opts.perTaskChatId ? { perTaskChatId: opts.perTaskChatId } : {},
1791
1888
  ...opts.perTaskChatName ? { perTaskChatName: opts.perTaskChatName } : {}
1792
1889
  });
@@ -1812,6 +1909,7 @@ class LarkCardPatchNotifier {
1812
1909
  lifecycle: opts.lifecycle,
1813
1910
  ...opts.activity !== undefined ? { activity: opts.activity } : {},
1814
1911
  ...opts.task !== undefined ? { task: opts.task } : {},
1912
+ ...opts.tasks !== undefined ? { sessionTasks: opts.tasks, taskTotal: opts.tasks.length } : {},
1815
1913
  ...opts.perTaskChatId ? { perTaskChatId: opts.perTaskChatId } : {},
1816
1914
  ...opts.perTaskChatName ? { perTaskChatName: opts.perTaskChatName } : {}
1817
1915
  });
@@ -1847,6 +1945,10 @@ class LarkCardPatchNotifier {
1847
1945
  ...state.perTaskChatId ? { perTaskChatId: state.perTaskChatId } : {},
1848
1946
  ...state.perTaskChatName ? { perTaskChatName: state.perTaskChatName } : {},
1849
1947
  ...opts.recentMessages !== undefined ? { recentMessages: opts.recentMessages } : state.recentMessages !== undefined ? { recentMessages: state.recentMessages } : {},
1948
+ ...opts.sessionTasks !== undefined ? { tasks: opts.sessionTasks } : state.sessionTasks !== undefined ? { tasks: state.sessionTasks } : {},
1949
+ ...state.taskTotal !== undefined ? { taskTotal: state.taskTotal } : {},
1950
+ ...opts.selectedTask !== undefined ? { selectedTask: opts.selectedTask } : state.selectedTask !== undefined ? { selectedTask: state.selectedTask } : {},
1951
+ ...opts.selectedTaskMilestones !== undefined ? { selectedTaskMilestones: opts.selectedTaskMilestones } : state.selectedTaskMilestones !== undefined ? { selectedTaskMilestones: state.selectedTaskMilestones } : {},
1850
1952
  ...opts.now !== undefined ? { activityNow: opts.now } : {}
1851
1953
  });
1852
1954
  if (opts.task !== undefined) {
@@ -1863,6 +1965,20 @@ class LarkCardPatchNotifier {
1863
1965
  if (opts.lifecycle !== undefined) {
1864
1966
  this.rememberSessionCard(messageId, { lifecycle: opts.lifecycle });
1865
1967
  }
1968
+ if (opts.sessionTasks !== undefined) {
1969
+ this.rememberSessionCard(messageId, {
1970
+ sessionTasks: opts.sessionTasks,
1971
+ taskTotal: opts.sessionTasks.length
1972
+ });
1973
+ }
1974
+ if (opts.selectedTask !== undefined) {
1975
+ this.rememberSessionCard(messageId, { selectedTask: opts.selectedTask });
1976
+ }
1977
+ if (opts.selectedTaskMilestones !== undefined) {
1978
+ this.rememberSessionCard(messageId, {
1979
+ selectedTaskMilestones: opts.selectedTaskMilestones
1980
+ });
1981
+ }
1866
1982
  if (activity !== undefined) {
1867
1983
  this.rememberSessionCard(messageId, { activity });
1868
1984
  }
@@ -1885,7 +2001,11 @@ class LarkCardPatchNotifier {
1885
2001
  recentMessages: state.recentMessages !== undefined ? state.recentMessages : prev?.recentMessages,
1886
2002
  task: state.task ?? prev?.task,
1887
2003
  perTaskChatId: state.perTaskChatId ?? prev?.perTaskChatId,
1888
- perTaskChatName: state.perTaskChatName ?? prev?.perTaskChatName
2004
+ perTaskChatName: state.perTaskChatName ?? prev?.perTaskChatName,
2005
+ sessionTasks: state.sessionTasks !== undefined ? state.sessionTasks : prev?.sessionTasks,
2006
+ taskTotal: state.taskTotal ?? prev?.taskTotal,
2007
+ selectedTask: state.selectedTask ?? prev?.selectedTask,
2008
+ selectedTaskMilestones: state.selectedTaskMilestones !== undefined ? state.selectedTaskMilestones : prev?.selectedTaskMilestones
1889
2009
  });
1890
2010
  }
1891
2011
  finalisedCards = new Set;
@@ -2251,6 +2371,31 @@ __legacyDecorateClassTS([
2251
2371
  })
2252
2372
  })
2253
2373
  ], LarkCardPatchNotifier.prototype, "finishTask", null);
2374
+ __legacyDecorateClassTS([
2375
+ TracedAs("lark-card.adopt", {
2376
+ recordParams: true,
2377
+ paramFilter: (args) => ({ sessionId: args[0], messageId: args[1] })
2378
+ })
2379
+ ], LarkCardPatchNotifier.prototype, "adoptSessionCard", null);
2380
+ __legacyDecorateClassTS([
2381
+ TracedAs("lark-card.restore", { recordParams: false, recordResult: true })
2382
+ ], LarkCardPatchNotifier.prototype, "restoreSessionCardsFromStore", null);
2383
+ __legacyDecorateClassTS([
2384
+ TracedAs("lark-card.upsert", {
2385
+ recordParams: true,
2386
+ flattenParamFilter: true,
2387
+ paramFilter: (args) => {
2388
+ const o = args[0] ?? {};
2389
+ return {
2390
+ chatId: o.chatId,
2391
+ sessionId: o.sessionId,
2392
+ title: o.title,
2393
+ statusPhrase: o.statusPhrase,
2394
+ lifecycle: o.lifecycle
2395
+ };
2396
+ }
2397
+ })
2398
+ ], LarkCardPatchNotifier.prototype, "upsertSessionCard", null);
2254
2399
  __legacyDecorateClassTS([
2255
2400
  TracedAs("lark-card.startWorkflow", {
2256
2401
  recordParams: true,
@@ -2386,4 +2531,4 @@ function hasSharedLarkCardNotifier() {
2386
2531
  return sharedNotifier !== undefined;
2387
2532
  }
2388
2533
 
2389
- export { MemoryLarkCardStateStore, SqliteLarkCardStateStore, getDefaultLarkCardDbPath, createLarkCardStateStore, getSharedLarkCardStateStore, formatTimestampForDisplay, sanitizeInlineText, HEAD_TITLE_MAX_WIDTH, truncateHeadTitle, formatDateTimeForDisplay, renderProgressBar, resolveTaskTitleForDisplay, humanizeValue, isTerminalStatusForTimeline, isTerminalStatusForWorkflowTimeline, buildCollapsiblePanel, renderTaskInfoLines, renderContextAsLines, renderMilestones, renderProcessSteps, partitionProcessSteps, buildTaskCard, buildSessionCard, buildChatAppLink, DEFAULT_APP_LINK_BASE, formatDurationMs, renderWorkflowInfoLines, buildWorkflowCard, LarkCardPatchNotifier, getSharedLarkCardNotifier, __resetSharedLarkCardNotifierForTest, hasSharedLarkCardNotifier };
2534
+ export { MemoryLarkCardStateStore, SqliteLarkCardStateStore, getDefaultLarkCardDbPath, createLarkCardStateStore, getSharedLarkCardStateStore, formatTimestampForDisplay, sanitizeInlineText, HEAD_TITLE_MAX_WIDTH, truncateHeadTitle, formatDateTimeForDisplay, renderProgressBar, resolveTaskTitleForDisplay, humanizeValue, isTerminalStatusForTimeline, isTerminalStatusForWorkflowTimeline, buildCollapsiblePanel, renderTaskInfoLines, renderContextAsLines, renderMilestones, renderProcessSteps, SESSION_TASK_LIST_MAX, renderSessionTaskList, partitionProcessSteps, buildTaskCard, buildSessionCard, buildChatAppLink, DEFAULT_APP_LINK_BASE, formatDurationMs, renderWorkflowInfoLines, buildWorkflowCard, LarkCardPatchNotifier, getSharedLarkCardNotifier, __resetSharedLarkCardNotifierForTest, hasSharedLarkCardNotifier };
@@ -5,7 +5,7 @@ import {
5
5
  initDatabase,
6
6
  initializeTables,
7
7
  resetDatabase
8
- } from "./roy-agent-core-ktphs7sj.js";
8
+ } from "./roy-agent-core-h89whnxz.js";
9
9
  import"./roy-agent-core-yqwwebhr.js";
10
10
  import"./roy-agent-core-m3vmmvbc.js";
11
11
  import"./roy-agent-core-yshw2fvj.js";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  BackgroundTaskManager,
11
11
  createDelegateTool
12
- } from "./roy-agent-core-x36a0g3x.js";
12
+ } from "./roy-agent-core-m4x47ne9.js";
13
13
  import {
14
14
  RemoteTaskStore
15
15
  } from "./roy-agent-core-7sfz2n7t.js";
@@ -88,7 +88,9 @@ var TASK_DEFAULTS = {
88
88
  "task.storage.type": "sqlite",
89
89
  "task.storage.dbPath": undefined,
90
90
  "task.storage.endpoint": undefined,
91
- "task.storage.authToken": undefined
91
+ "task.storage.authToken": undefined,
92
+ "task.plugins.larkCard.emitTaskCard": true,
93
+ "task.plugins.larkCard.emitSessionCard": true
92
94
  };
93
95
  var TASK_CONFIG_REGISTRATION = {
94
96
  name: "task",
@@ -99,7 +101,9 @@ var TASK_CONFIG_REGISTRATION = {
99
101
  { key: "task.storage.type", sources: ["env", "file"] },
100
102
  { key: "task.storage.dbPath", sources: ["env", "file"] },
101
103
  { key: "task.storage.endpoint", sources: ["env", "file"] },
102
- { key: "task.storage.authToken", sources: ["env", "file"] }
104
+ { key: "task.storage.authToken", sources: ["env", "file"] },
105
+ { key: "task.plugins.larkCard.emitTaskCard", sources: ["env", "file"] },
106
+ { key: "task.plugins.larkCard.emitSessionCard", sources: ["env", "file"] }
103
107
  ]
104
108
  };
105
109
 
@@ -228,6 +232,20 @@ class TaskComponent extends BaseComponent {
228
232
  getBackgroundTaskManager() {
229
233
  return this.backgroundTaskManager;
230
234
  }
235
+ getCardNotifyConfig() {
236
+ const readFlag = (key) => {
237
+ try {
238
+ const v = this.configComponent?.get(key);
239
+ return v !== false;
240
+ } catch {
241
+ return true;
242
+ }
243
+ };
244
+ return {
245
+ emitTaskCard: readFlag("task.plugins.larkCard.emitTaskCard"),
246
+ emitSessionCard: readFlag("task.plugins.larkCard.emitSessionCard")
247
+ };
248
+ }
231
249
  publishEvent(type, payload, sessionId) {
232
250
  if (this.env?.pushEnvEvent) {
233
251
  this.env.pushEnvEvent({
@@ -269,7 +287,7 @@ class TaskComponent extends BaseComponent {
269
287
  type: "file",
270
288
  relativePath: configPath,
271
289
  optional: true,
272
- watch: false
290
+ watch: true
273
291
  });
274
292
  }
275
293
  configComponent.registerSource({
@@ -19,7 +19,7 @@ import {
19
19
  createWecomTaskNotifyHook,
20
20
  deleteGroupChatViaLarkCli,
21
21
  handleCardAction
22
- } from "./roy-agent-core-45n2r4my.js";
22
+ } from "./roy-agent-core-f2m9yg68.js";
23
23
  import {
24
24
  registerWecomRespondTarget,
25
25
  sendWecomCliMarkdown,
@@ -34,15 +34,15 @@ import {
34
34
  } from "./roy-agent-core-c4ec7k0p.js";
35
35
  import {
36
36
  getSharedEventStore
37
- } from "./roy-agent-core-3bt71phf.js";
37
+ } from "./roy-agent-core-brw8wp2q.js";
38
38
  import {
39
39
  createLarkCliWorkflowNotifyHook
40
- } from "./roy-agent-core-v3wm8gyj.js";
40
+ } from "./roy-agent-core-yfxdzysd.js";
41
41
  import {
42
42
  DEFAULT_APP_LINK_BASE,
43
43
  getSharedLarkCardNotifier,
44
44
  getSharedLarkCardStateStore
45
- } from "./roy-agent-core-0yzxapfa.js";
45
+ } from "./roy-agent-core-stcr4w4f.js";
46
46
  import {
47
47
  RECENT_MESSAGE_LIMIT,
48
48
  createActivityProbe,
@@ -4844,6 +4844,66 @@ class LarkCliInstance {
4844
4844
  const calls = extractToolCallsFromMessages(tail);
4845
4845
  return calls.slice(-n);
4846
4846
  },
4847
+ loadSessionTasks: async (sessionId) => {
4848
+ try {
4849
+ const ids = await taskComponent.getTaskIdsBySessionId?.(sessionId);
4850
+ if (!Array.isArray(ids) || ids.length === 0)
4851
+ return [];
4852
+ const SESSION_TASK_DETAIL_LIMIT = 20;
4853
+ const recentIds = [...ids].sort((a, b) => b - a).slice(0, SESSION_TASK_DETAIL_LIMIT);
4854
+ const items = [];
4855
+ const ts = (v) => {
4856
+ if (typeof v !== "string")
4857
+ return 0;
4858
+ const n = Date.parse(v);
4859
+ return Number.isFinite(n) ? n : 0;
4860
+ };
4861
+ for (const id of recentIds) {
4862
+ try {
4863
+ const t = await taskComponent.getTask(id);
4864
+ if (!t?.id)
4865
+ continue;
4866
+ const updatedAt = t.updatedAt ?? t.updated_at;
4867
+ items.push({
4868
+ id: t.id,
4869
+ ...t.title ? { title: t.title } : {},
4870
+ ...t.status ? { status: String(t.status) } : {},
4871
+ ...typeof t.progress === "number" ? { progress: t.progress } : {},
4872
+ _ts: ts(updatedAt)
4873
+ });
4874
+ } catch {}
4875
+ }
4876
+ items.sort((a, b) => b._ts - a._ts || b.id - a.id);
4877
+ return {
4878
+ tasks: items.map(({ _ts: _ignored, ...rest }) => rest),
4879
+ total: ids.length
4880
+ };
4881
+ } catch (err) {
4882
+ logger4.warn(`loadSessionTasks(${sessionId}) 失败(任务列表面板降级为空): ` + `${err.message}`);
4883
+ return [];
4884
+ }
4885
+ },
4886
+ loadTaskMilestones: async (taskId) => {
4887
+ try {
4888
+ const ops = await taskComponent.listOperations?.({ taskId, limit: 50 });
4889
+ if (!Array.isArray(ops) || ops.length === 0)
4890
+ return [];
4891
+ return ops.map((op) => {
4892
+ const o = op;
4893
+ const title = o.milestoneTitle ?? o.actionTitle;
4894
+ if (!title)
4895
+ return;
4896
+ return {
4897
+ title,
4898
+ timestamp: o.timestamp ?? new Date().toISOString(),
4899
+ ...o.milestoneDescription ?? o.actionDescription ? { description: o.milestoneDescription ?? o.actionDescription } : {}
4900
+ };
4901
+ }).filter((m) => m !== undefined);
4902
+ } catch (err) {
4903
+ logger4.warn(`loadTaskMilestones(${taskId}) 失败(里程碑区降级为空): ` + `${err.message}`);
4904
+ return [];
4905
+ }
4906
+ },
4847
4907
  attachGroupSession: async (args) => {
4848
4908
  const sessionComponent = this.environment?.getComponent?.("session");
4849
4909
  if (typeof sessionComponent?.attachGroupSession !== "function") {
@@ -2,7 +2,7 @@ import {
2
2
  createAutoTaskPlugin,
3
3
  createLayaDecisionPlugin,
4
4
  registerLayaCompletionTaskHook
5
- } from "./roy-agent-core-45n2r4my.js";
5
+ } from "./roy-agent-core-f2m9yg68.js";
6
6
  import {
7
7
  TaskHookPoints
8
8
  } from "./roy-agent-core-1pg0fepg.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LarkCardPatchNotifier,
3
3
  formatDurationMs
4
- } from "./roy-agent-core-0yzxapfa.js";
4
+ } from "./roy-agent-core-stcr4w4f.js";
5
5
  import {
6
6
  WorkflowHookPoints,
7
7
  init_workflow_hook_points
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.7.92",
3
+ "version": "1.7.94",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",