@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
@@ -91,6 +91,63 @@ export interface TaskNotifyConfig {
91
91
  * 老卡片再也无法 patch(永远停在"进行中")+ pin 一直挂着。
92
92
  */
93
93
  cardStateStore?: LarkCardStateStore;
94
+ /**
95
+ * ★ Task #5580:是否在 session 卡之外**再发一张任务卡片**(默认 true)。
96
+ *
97
+ * ## 背景(用户 2026-11-13 定稿)
98
+ *
99
+ * 「之前的任务卡片功能必须保留:lark-cli ES 插件中根据 task hook 触发的
100
+ * 任务卡片消息也要发出来并 pin 住。不能只有 session 卡片——两者并存:
101
+ * 任务卡片(用户关心任务级别)+ session 卡片(调试用,功能以后削弱)」
102
+ *
103
+ * 这**反转**了 #5364 的「单卡语义」(当时定稿:一个 session 只发一张卡,
104
+ * task 信息作为卡上区块)。现在两者并存:
105
+ * - session 卡:会话视角(任务列表 / 执行动态 / 活性)—— 调试用,后续削弱
106
+ * - task 卡:任务视角(进度 / 里程碑 / 建群)—— 用户主关注
107
+ *
108
+ * 设 `false` 可退回 #5364 的单卡语义(软回滚开关)。
109
+ */
110
+ emitTaskCard?: boolean;
111
+ /**
112
+ * ★ Task #5580:config.jsonc 开关读取端口(生产装配注入)。
113
+ * 不传 ⇒ 退回 `emitTaskCard` 代码级默认 / true。
114
+ */
115
+ cardNotifyConfigReader?: () => LarkCardNotifyFlags;
116
+ }
117
+ /**
118
+ * ★ Task #5580(2026-11-15 补充):config.jsonc 可配的卡片开关。
119
+ *
120
+ * ## 配置键(config.jsonc)
121
+ *
122
+ * ```jsonc
123
+ * {
124
+ * "task": {
125
+ * "plugins": {
126
+ * "larkCard": {
127
+ * // task hook 触发的任务卡片(用户主关注,pin)
128
+ * "emitTaskCard": true,
129
+ * // sub-session 生命周期触发的 session 卡片(调试用)
130
+ * "emitSessionCard": true
131
+ * }
132
+ * }
133
+ * }
134
+ * }
135
+ * ```
136
+ *
137
+ * ## 生效方式(热更新)
138
+ *
139
+ * config.jsonc 是 task 组件的 file source(watch 开启)⇒
140
+ * **改文件即生效,无需重启 ES**。开关在每次 hook 执行 / 每次
141
+ * session 生命周期事件时**现读**(不是构造时缓存)。
142
+ *
143
+ * ## 优先级
144
+ *
145
+ * 显式传给 hook 的 `config.emitTaskCard`(代码级)优先于
146
+ * config.jsonc(文件级)—— 便于单测与特殊部署覆盖。
147
+ */
148
+ export interface LarkCardNotifyFlags {
149
+ emitTaskCard: boolean;
150
+ emitSessionCard: boolean;
94
151
  }
95
152
  /**
96
153
  * 卡片路由端口(Task #4230 follow-up)
@@ -118,6 +175,14 @@ export declare class LarkCliTaskNotifyHook implements Hook {
118
175
  readonly pluginName?: string;
119
176
  readonly sourceId?: string;
120
177
  private readonly config;
178
+ /**
179
+ * ★ Task #5580:config.jsonc 开关的读取端口(可选注入)。
180
+ *
181
+ * 生产装配点(task-component)注入 `taskComponent.getCardNotifyConfig`;
182
+ * 不注入(单测 / 未接线)⇒ 退回 `config.emitTaskCard` 代码级默认。
183
+ * 每次 hook 执行时现读 ⇒ config.jsonc 热更新即时生效。
184
+ */
185
+ cardNotifyConfigReader?: () => LarkCardNotifyFlags;
121
186
  /** 卡片模式 notifier 实例 */
122
187
  private cardNotifier?;
123
188
  /**
@@ -185,6 +250,16 @@ export declare class LarkCliTaskNotifyHook implements Hook {
185
250
  setCardRoutingPorts(ports: CardRoutingPorts): void;
186
251
  /** 诊断:端口是否注入 */
187
252
  hasCardRoutingPorts(): boolean;
253
+ /**
254
+ * ★ Task #5580:emitTaskCard 的**现读**语义。
255
+ *
256
+ * 优先级:显式 config.emitTaskCard(代码级)> config.jsonc
257
+ * (文件级,经 cardNotifyConfigReader)> 默认 true。
258
+ *
259
+ * 为什么不用构造时缓存:config.jsonc 是 file source(watch 开),
260
+ * 用户改文件应即时生效 —— 每次执行现读。
261
+ */
262
+ private currentEmitTaskCard;
188
263
  execute(ctx: HookContext<unknown>): Promise<void>;
189
264
  /** 任务创建:发初始卡片(+ pin) */
190
265
  private onAfterCreate;
@@ -87,6 +87,31 @@ export declare class TaskComponent extends BaseComponent {
87
87
  * or has been disposed.
88
88
  */
89
89
  getBackgroundTaskManager(): BackgroundTaskManager | undefined;
90
+ /**
91
+ * ★ Task #5580(2026-11-15 补充)—— lark 卡片开关(config.jsonc 可配)。
92
+ *
93
+ * ## 配置键(沿用 task 组件点号惯例)
94
+ *
95
+ * - `task.plugins.larkCard.emitTaskCard`(默认 true)
96
+ * —— task hook 触发的**任务卡片**(用户主关注,pin)
97
+ * - `task.plugins.larkCard.emitSessionCard`(默认 true)
98
+ * —— sub-session 生命周期触发的 **session 卡片**(调试用)
99
+ *
100
+ * ## 生效方式
101
+ *
102
+ * config.jsonc 是 task 组件的 file source(watch 开启)⇒
103
+ * 改文件即热更新,**无需重启 ES**。每次 hook 执行时现读
104
+ * (`LarkCliTaskNotifyHook` 在 execute 内调用本方法)。
105
+ *
106
+ * ## 降级
107
+ *
108
+ * configComponent 缺失 / 键未配置 / 值不是 boolean ⇒ 默认 true
109
+ * (与改造前行为一致:两卡并存)。
110
+ */
111
+ getCardNotifyConfig(): {
112
+ emitTaskCard: boolean;
113
+ emitSessionCard: boolean;
114
+ };
90
115
  /**
91
116
  * 发布 EnvEvent
92
117
  */
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-vevc6pex.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-qtb41z61.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-acbg6fg9.js";
5
5
  import {
6
6
  Edge,
@@ -14,9 +14,9 @@ import {
14
14
  DecoratorNode,
15
15
  init_decorator_node
16
16
  } from "../../shared/@ai-setting/roy-agent-core-0k9spnmd.js";
17
- import"../../shared/@ai-setting/roy-agent-core-wpc432x7.js";
18
- import"../../shared/@ai-setting/roy-agent-core-ey945nk5.js";
19
- import"../../shared/@ai-setting/roy-agent-core-bp1n3z48.js";
17
+ import"../../shared/@ai-setting/roy-agent-core-1gx70hsn.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-h5v1xe9h.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-f18s4qgp.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-hhrg314p.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-64ke8s3t.js";
22
22
  import"../../shared/@ai-setting/roy-agent-core-bwyc2j0n.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  LarkCliWorkflowNotifyHook,
3
3
  createLarkCliWorkflowNotifyHook
4
- } from "../../../shared/@ai-setting/roy-agent-core-v3wm8gyj.js";
5
- import"../../../shared/@ai-setting/roy-agent-core-0yzxapfa.js";
4
+ } from "../../../shared/@ai-setting/roy-agent-core-yfxdzysd.js";
5
+ import"../../../shared/@ai-setting/roy-agent-core-stcr4w4f.js";
6
6
  import"../../../shared/@ai-setting/roy-agent-core-418zc9ha.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-pxqz1d1m.js";
8
8
  import"../../../shared/@ai-setting/roy-agent-core-5e9vmj5e.js";
@@ -8,7 +8,7 @@ import {
8
8
  migrateEmptyTagsToDefault,
9
9
  resetDatabase,
10
10
  rowToWorkflow
11
- } from "../../../shared/@ai-setting/roy-agent-core-ktphs7sj.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-h89whnxz.js";
12
12
  import {
13
13
  TagRepository
14
14
  } from "../../../shared/@ai-setting/roy-agent-core-yqwwebhr.js";
@@ -24,9 +24,9 @@ import {
24
24
  getRunWorkflowTool,
25
25
  initRunWorkflowTool,
26
26
  resetRunWorkflowTool
27
- } from "../../../shared/@ai-setting/roy-agent-core-wpc432x7.js";
28
- import"../../../shared/@ai-setting/roy-agent-core-ey945nk5.js";
29
- import"../../../shared/@ai-setting/roy-agent-core-bp1n3z48.js";
27
+ } from "../../../shared/@ai-setting/roy-agent-core-1gx70hsn.js";
28
+ import"../../../shared/@ai-setting/roy-agent-core-h5v1xe9h.js";
29
+ import"../../../shared/@ai-setting/roy-agent-core-f18s4qgp.js";
30
30
  import"../../../shared/@ai-setting/roy-agent-core-64ke8s3t.js";
31
31
  import"../../../shared/@ai-setting/roy-agent-core-bwyc2j0n.js";
32
32
  import {
package/dist/index.js CHANGED
@@ -56,19 +56,19 @@ import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
56
56
  import"./shared/@ai-setting/roy-agent-core-m1fgtnrc.js";
57
57
  import {
58
58
  closeDatabase
59
- } from "./shared/@ai-setting/roy-agent-core-ktphs7sj.js";
59
+ } from "./shared/@ai-setting/roy-agent-core-h89whnxz.js";
60
60
  import"./shared/@ai-setting/roy-agent-core-yqwwebhr.js";
61
61
  import {
62
62
  BaseEnvironment,
63
63
  generateDescendingId,
64
64
  generateId
65
- } from "./shared/@ai-setting/roy-agent-core-15wktzhv.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-xtwnakt8.js";
66
66
  import {
67
67
  TaskComponent
68
- } from "./shared/@ai-setting/roy-agent-core-f82pd49t.js";
68
+ } from "./shared/@ai-setting/roy-agent-core-vw4gv5am.js";
69
69
  import"./shared/@ai-setting/roy-agent-core-jzmk4kdh.js";
70
70
  import"./shared/@ai-setting/roy-agent-core-jm136jzh.js";
71
- import"./shared/@ai-setting/roy-agent-core-x36a0g3x.js";
71
+ import"./shared/@ai-setting/roy-agent-core-m4x47ne9.js";
72
72
  import"./shared/@ai-setting/roy-agent-core-pd2hd3q9.js";
73
73
  import"./shared/@ai-setting/roy-agent-core-5p3arx77.js";
74
74
  import {
@@ -80,7 +80,7 @@ import"./shared/@ai-setting/roy-agent-core-bcv09vrt.js";
80
80
  import"./shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
81
81
  import {
82
82
  EventSourceComponent
83
- } from "./shared/@ai-setting/roy-agent-core-xe03wwy9.js";
83
+ } from "./shared/@ai-setting/roy-agent-core-18xsrema.js";
84
84
  import {
85
85
  BountyIMInstance,
86
86
  COMMAND_PREFIX,
@@ -135,7 +135,7 @@ import {
135
135
  translateCardActionToCommand,
136
136
  wecomCliHandler,
137
137
  writeFallbackModelList
138
- } from "./shared/@ai-setting/roy-agent-core-kk2k20a3.js";
138
+ } from "./shared/@ai-setting/roy-agent-core-w9qpbpa1.js";
139
139
  import {
140
140
  BUILT_IN_EVENT_SOURCE_TYPES,
141
141
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -161,7 +161,7 @@ import"./shared/@ai-setting/roy-agent-core-2stt4rp5.js";
161
161
  import {
162
162
  TaskTagPlugin,
163
163
  createAutoTaskPlugin
164
- } from "./shared/@ai-setting/roy-agent-core-45n2r4my.js";
164
+ } from "./shared/@ai-setting/roy-agent-core-f2m9yg68.js";
165
165
  import"./shared/@ai-setting/roy-agent-core-th8fq714.js";
166
166
  import"./shared/@ai-setting/roy-agent-core-c4ec7k0p.js";
167
167
  import {
@@ -169,7 +169,7 @@ import {
169
169
  getSharedEventStore,
170
170
  resetSharedEventStore,
171
171
  setSharedEventStore
172
- } from "./shared/@ai-setting/roy-agent-core-3bt71phf.js";
172
+ } from "./shared/@ai-setting/roy-agent-core-brw8wp2q.js";
173
173
  import {
174
174
  getBuiltInPrompt,
175
175
  getBuiltInPromptNames
@@ -191,8 +191,8 @@ import {
191
191
  TASK_COMPLETED_STATUS_WORD,
192
192
  TASK_DELIVERABLE_RECORDED
193
193
  } from "./shared/@ai-setting/roy-agent-core-4rtg69cn.js";
194
- import"./shared/@ai-setting/roy-agent-core-v3wm8gyj.js";
195
- import"./shared/@ai-setting/roy-agent-core-0yzxapfa.js";
194
+ import"./shared/@ai-setting/roy-agent-core-yfxdzysd.js";
195
+ import"./shared/@ai-setting/roy-agent-core-stcr4w4f.js";
196
196
  import"./shared/@ai-setting/roy-agent-core-418zc9ha.js";
197
197
  import {
198
198
  SQLiteTaskStore,
@@ -200,7 +200,7 @@ import {
200
200
  } from "./shared/@ai-setting/roy-agent-core-pxqz1d1m.js";
201
201
  import {
202
202
  WorkflowComponent
203
- } from "./shared/@ai-setting/roy-agent-core-vevc6pex.js";
203
+ } from "./shared/@ai-setting/roy-agent-core-qtb41z61.js";
204
204
  import {
205
205
  init_node_registry_helper,
206
206
  registerDecoratorNodeType
@@ -213,13 +213,13 @@ import {
213
213
  createWorkflowFromClass
214
214
  } from "./shared/@ai-setting/roy-agent-core-p13a4x6r.js";
215
215
  import"./shared/@ai-setting/roy-agent-core-0k9spnmd.js";
216
- import"./shared/@ai-setting/roy-agent-core-wpc432x7.js";
216
+ import"./shared/@ai-setting/roy-agent-core-1gx70hsn.js";
217
217
  import {
218
218
  SessionComponent
219
- } from "./shared/@ai-setting/roy-agent-core-ey945nk5.js";
219
+ } from "./shared/@ai-setting/roy-agent-core-h5v1xe9h.js";
220
220
  import {
221
221
  MemorySessionStore
222
- } from "./shared/@ai-setting/roy-agent-core-bp1n3z48.js";
222
+ } from "./shared/@ai-setting/roy-agent-core-f18s4qgp.js";
223
223
  import"./shared/@ai-setting/roy-agent-core-hhrg314p.js";
224
224
  import"./shared/@ai-setting/roy-agent-core-64ke8s3t.js";
225
225
  import"./shared/@ai-setting/roy-agent-core-bwyc2j0n.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInHandlers
3
- } from "./roy-agent-core-kk2k20a3.js";
3
+ } from "./roy-agent-core-w9qpbpa1.js";
4
4
  import {
5
5
  appendAuditLog,
6
6
  checkSourceCountDrop,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isValidSessionId
3
- } from "./roy-agent-core-ey945nk5.js";
3
+ } from "./roy-agent-core-h5v1xe9h.js";
4
4
  import {
5
5
  TAG_MAX_COUNT,
6
6
  TAG_MIN_COUNT
@@ -17,9 +17,14 @@ function getDatabaseClass() {
17
17
  if (typeof Bun !== "undefined") {
18
18
  const { Database } = __require("bun:sqlite");
19
19
  return Database;
20
- } else {
21
- return require_lib();
22
20
  }
21
+ try {
22
+ const { DatabaseSync } = __require("node:sqlite");
23
+ if (typeof DatabaseSync === "function") {
24
+ return DatabaseSync;
25
+ }
26
+ } catch {}
27
+ return require_lib();
23
28
  }
24
29
  function createCompatibleDatabase(path) {
25
30
  const Database = getDatabaseClass();
@@ -564,9 +564,14 @@ function getDatabaseClass() {
564
564
  if (typeof Bun !== "undefined") {
565
565
  const { Database } = __require("bun:sqlite");
566
566
  return Database;
567
- } else {
568
- return require_lib();
569
567
  }
568
+ try {
569
+ const { DatabaseSync } = __require("node:sqlite");
570
+ if (typeof DatabaseSync === "function") {
571
+ return DatabaseSync;
572
+ }
573
+ } catch {}
574
+ return require_lib();
570
575
  }
571
576
  function isSqliteBusyError(err) {
572
577
  if (err == null)