@ai-setting/roy-agent-core 1.7.93 → 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.
@@ -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-px73ewzd.js";
22
+ } from "./roy-agent-core-f2m9yg68.js";
23
23
  import {
24
24
  registerWecomRespondTarget,
25
25
  sendWecomCliMarkdown,
@@ -37,12 +37,12 @@ import {
37
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-px73ewzd.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.93",
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",