@ai-setting/roy-agent-core 1.7.71 → 1.7.75
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/agent/agent-component.js +6 -6
- package/dist/env/agent/agent-registry.d.ts +4 -1
- package/dist/env/agent/index.js +6 -6
- package/dist/env/agent/summary-agent.d.ts +6 -15
- package/dist/env/agent/types.d.ts +0 -17
- package/dist/env/error-reply.d.ts +46 -0
- package/dist/env/error-reply.js +3 -1
- package/dist/env/event-source/event-source-handlers.js +12 -12
- package/dist/env/event-source/index.js +13 -13
- package/dist/env/index.js +30 -31
- package/dist/env/llm/index.js +2 -2
- package/dist/env/llm/orphan-toolcall.d.ts +107 -0
- package/dist/env/llm/temperature-policy.d.ts +107 -0
- package/dist/env/llm/types.d.ts +2 -2
- package/dist/env/plugin/index.js +3 -3
- package/dist/env/prompt/index.js +3 -3
- package/dist/env/prompt/prompts-index.d.ts +26 -4
- package/dist/env/session/__bench__/replay-compact.d.ts +137 -0
- package/dist/env/session/__bench__/run-replay.d.ts +15 -0
- package/dist/env/session/compact-checkpoint-content.d.ts +67 -0
- package/dist/env/session/index.d.ts +1 -0
- package/dist/env/session/index.js +4 -5
- package/dist/env/session/session-component.d.ts +47 -30
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/session/storage/sqlite.d.ts +8 -0
- package/dist/env/session/types.d.ts +45 -30
- package/dist/env/task/delegate/delegate-tool.d.ts +8 -0
- package/dist/env/task/delegate/delegate-tool.js +4 -4
- package/dist/env/task/delegate/index.js +4 -4
- package/dist/env/task/index.js +7 -7
- package/dist/env/task/mcp/index.js +2 -2
- package/dist/env/task/plugins/index.d.ts +3 -0
- package/dist/env/task/plugins/index.js +32 -9
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +61 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +6 -2
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +42 -0
- package/dist/env/task/prompt/index.js +1 -1
- package/dist/env/task/prompt/task-discipline.d.ts +9 -3
- package/dist/env/task/tools/cancel-tool.d.ts +28 -0
- package/dist/env/task/tools/index.d.ts +1 -0
- package/dist/env/task/tools/index.js +4 -2
- package/dist/env/task/tools/task-types.d.ts +22 -0
- package/dist/env/tool/built-in/compact-session-tool.d.ts +120 -0
- package/dist/env/tool/built-in/index.d.ts +2 -0
- package/dist/env/tool/built-in/index.js +6 -2
- package/dist/env/tool/index.js +4 -4
- package/dist/env/workflow/engine/index.js +6 -7
- package/dist/env/workflow/index.js +15 -14
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/tools/ask-user-tool.d.ts +88 -0
- package/dist/env/workflow/tools/index.js +11 -10
- package/dist/env/workflow/tools/run-workflow.d.ts +2 -2
- package/dist/env/workflow/types/index.js +2 -2
- package/dist/env/workflow/types/workflow-hil.d.ts +25 -1
- package/dist/env/workflow/utils/index.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -34
- package/dist/shared/@ai-setting/{roy-agent-core-hy3zn2q2.js → roy-agent-core-0qyrk5k0.js} +22 -2
- package/dist/shared/@ai-setting/{roy-agent-core-kmbct9yg.js → roy-agent-core-0snm5hc5.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4jjwewvw.js → roy-agent-core-11shp00p.js} +31 -10
- package/dist/shared/@ai-setting/{roy-agent-core-yr1mryb8.js → roy-agent-core-1v4g0d4x.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-02j24hrg.js → roy-agent-core-264qexac.js} +71 -4
- package/dist/shared/@ai-setting/{roy-agent-core-9geem94g.js → roy-agent-core-29b6hc39.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-2akfd64z.js +374 -0
- package/dist/shared/@ai-setting/{roy-agent-core-zv8bswpw.js → roy-agent-core-3e6gg17d.js} +120 -28
- package/dist/shared/@ai-setting/{roy-agent-core-8cx7cfdg.js → roy-agent-core-3fh1f7s7.js} +2 -3
- package/dist/shared/@ai-setting/{roy-agent-core-mwa6apzx.js → roy-agent-core-4gr3k7qg.js} +17 -4
- package/dist/shared/@ai-setting/{roy-agent-core-zsbh9bfv.js → roy-agent-core-60jbrfye.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-add1zqsh.js → roy-agent-core-6cy43nss.js} +22 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mw2cen6s.js → roy-agent-core-6rh8k6ba.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-kpg25s2q.js → roy-agent-core-8ez6mccb.js} +4 -2
- package/dist/shared/@ai-setting/{roy-agent-core-sjr1kmfz.js → roy-agent-core-acj8ag08.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mds8tqd0.js → roy-agent-core-cgtq6427.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9bshyqjn.js → roy-agent-core-ddyk1rc0.js} +183 -132
- package/dist/shared/@ai-setting/{roy-agent-core-hfr6bzts.js → roy-agent-core-djpq6yb0.js} +16 -7
- package/dist/shared/@ai-setting/{roy-agent-core-002g6nfk.js → roy-agent-core-dqxec05w.js} +7 -6
- package/dist/shared/@ai-setting/{roy-agent-core-07fvy74y.js → roy-agent-core-ed233k5z.js} +21 -7
- package/dist/shared/@ai-setting/{roy-agent-core-jrj30vq3.js → roy-agent-core-er070zjq.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-40rv283c.js → roy-agent-core-fghc2m8z.js} +152 -2
- package/dist/shared/@ai-setting/{roy-agent-core-7sj9xs9c.js → roy-agent-core-hnyk1by7.js} +110 -2
- package/dist/shared/@ai-setting/{roy-agent-core-101qtkyc.js → roy-agent-core-jg65qnwa.js} +11 -8
- package/dist/shared/@ai-setting/{roy-agent-core-e25xkv53.js → roy-agent-core-mkc3zshb.js} +3 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0cb6w0k7.js → roy-agent-core-mww0mnd9.js} +231 -27
- package/dist/shared/@ai-setting/{roy-agent-core-5repth1n.js → roy-agent-core-n9q1encx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-46rv4d7d.js → roy-agent-core-nmx9934r.js} +92 -2
- package/dist/shared/@ai-setting/{roy-agent-core-1w9y7mxj.js → roy-agent-core-p3zv1mx5.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-snvh4s2p.js +662 -0
- package/dist/shared/@ai-setting/{roy-agent-core-dt104qa1.js → roy-agent-core-v85n42ve.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-37tj4y6a.js → roy-agent-core-v87njmq7.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-k13pxrpk.js → roy-agent-core-y7x2qzwc.js} +553 -92
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-1gsbqesr.js +0 -1083
- package/dist/shared/@ai-setting/roy-agent-core-58804s3j.js +0 -155
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +0 -37
|
@@ -3,16 +3,15 @@ import {
|
|
|
3
3
|
MIN_SESSION_ID_LENGTH,
|
|
4
4
|
SessionComponent,
|
|
5
5
|
isValidSessionId
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-ddyk1rc0.js";
|
|
7
7
|
import {
|
|
8
8
|
MemorySessionStore
|
|
9
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
10
|
-
import"../../shared/@ai-setting/roy-agent-core-ze068vc9.js";
|
|
9
|
+
} from "../../shared/@ai-setting/roy-agent-core-0qyrk5k0.js";
|
|
11
10
|
import"../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
12
11
|
import {
|
|
13
12
|
SessionMessageConverter
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
} from "../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
16
15
|
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
17
16
|
import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
18
17
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
@@ -8,6 +8,7 @@ import { type SessionConfig, type Session, type CreateSessionOptions, type Updat
|
|
|
8
8
|
type CompactOptions, // (new)
|
|
9
9
|
type CompactResult, // (new)
|
|
10
10
|
type CompactPreview, // (new)
|
|
11
|
+
type CheckpointAdaptReport, // Task #4933
|
|
11
12
|
type GetContextOptions, // (new)
|
|
12
13
|
type GetContextResult, // (new)
|
|
13
14
|
type SearchMessagesOptions, // (new)
|
|
@@ -15,11 +16,11 @@ type SearchResult, // (new)
|
|
|
15
16
|
type ChatTaskBinding, // Task #4023
|
|
16
17
|
type UpsertChatTaskBindingOptions } from "./types";
|
|
17
18
|
import type { ConfigComponent } from "../../config/config-component";
|
|
18
|
-
import type { SummaryAgentResult } from "../agent/types";
|
|
19
19
|
export type { SessionConfig, Session, SessionMessage, CreateSessionOptions, UpdateSessionOptions, ListSessionsOptions, AddMessageOptions, SessionCheckpoint, // (new)
|
|
20
20
|
CompactOptions, // (new)
|
|
21
21
|
CompactResult, // (new)
|
|
22
22
|
CompactPreview, // (new)
|
|
23
|
+
CheckpointAdaptReport, // Task #4933
|
|
23
24
|
GetContextOptions, // (new)
|
|
24
25
|
GetContextResult, // (new)
|
|
25
26
|
SearchMessagesOptions, // (new) Search
|
|
@@ -27,35 +28,6 @@ SearchResult, // (new) Search
|
|
|
27
28
|
MessageMatch, // (new) Search
|
|
28
29
|
ChatTaskBinding, // Task #4023
|
|
29
30
|
UpsertChatTaskBindingOptions, } from "./types";
|
|
30
|
-
/**
|
|
31
|
-
* 把 compact agent 通过 `workflow_submit_output` 提交的数据归一化。
|
|
32
|
-
*/
|
|
33
|
-
export declare function normalizeAgentCheckpoint(data: Record<string, unknown>): SummaryAgentResult;
|
|
34
|
-
/**
|
|
35
|
-
* 判断一段文本是否可作为 checkpoint 正文(拒绝空白与降级哨兵)。
|
|
36
|
-
*/
|
|
37
|
-
export declare function isUsableCheckpointText(text?: string | null): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 降级路径:compact agent 没有调用 `workflow_submit_output` 时,用它输出的
|
|
40
|
-
* 纯文本 `finalText` 兜底构造 checkpoint。
|
|
41
|
-
*
|
|
42
|
-
* 为什么需要(2026-10-16 生产事故 traceId=83eadac2316d5be7529ca42ce7057d63):
|
|
43
|
-
* compact 是子 agent。首轮若没调提交工具,`checkpointData` 就是 undefined,
|
|
44
|
-
* 旧代码会写出全空 checkpoint(`"Untitled Checkpoint"`)**然后照样归档几百条消息**
|
|
45
|
-
* (实测生产 9 次 / 累计吞掉 4731 条 / 单次最多 2710 条)→ 上下文永久丢失且用户无感知。
|
|
46
|
-
*
|
|
47
|
-
* 而实际上模型往往已经产出了可用的 checkpoint 内容,只是以纯文本形式落在
|
|
48
|
-
* `finalText` 里(例:`"## 📌 Checkpoint: lark-cli profile 配置 ..."`),
|
|
49
|
-
* 或者包在 ```json 代码块里。这些内容全部可以救回来。
|
|
50
|
-
*
|
|
51
|
-
* 策略:
|
|
52
|
-
* 1. 先从文本里抠 JSON(```json 代码块 / 裸 JSON / 第一个 {...})→ 结构化解析;
|
|
53
|
-
* 2. 否则把整段文本作为 `currentState`,title 取首个 markdown 标题行(或首行);
|
|
54
|
-
* 3. 文本为空 / 是降级哨兵 → 返回 undefined(调用方继续降级或抛错)
|
|
55
|
-
*
|
|
56
|
-
* @returns 归一化后的 checkpoint,或 undefined(无可用文本)
|
|
57
|
-
*/
|
|
58
|
-
export declare function buildCheckpointFromFinalText(finalText?: string): SummaryAgentResult | undefined;
|
|
59
31
|
/**
|
|
60
32
|
* Marker error class so callers can distinguish "lock exhausted after
|
|
61
33
|
* retries" from "validation rejected on first attempt". Previously both
|
|
@@ -345,6 +317,19 @@ export declare class SessionComponent extends BaseComponent {
|
|
|
345
317
|
private executeBeforeHooks;
|
|
346
318
|
private executeAfterHooks;
|
|
347
319
|
private generateTitle;
|
|
320
|
+
/**
|
|
321
|
+
* 读取压缩专用模型(`session.compactModel`)。
|
|
322
|
+
*
|
|
323
|
+
* ★ Task #4933:两阶段压缩(compact-hint / compact)统一走该模型。
|
|
324
|
+
* 实现方式:读配置后作为 `AgentContext.model`(run option)传入,
|
|
325
|
+
* run option 在 agent-component.ts:1518
|
|
326
|
+
* `model: (context?.model) ?? agent.config.model` 处优先级最高,
|
|
327
|
+
* 因此**会覆盖**用户级 `~/.local/share/roy-agent/agents/compact.yaml`
|
|
328
|
+
* 里写死的 model 字段。
|
|
329
|
+
*
|
|
330
|
+
* @returns 模型 id(如 `minimax/MiniMax-M3.1-Flash`),未配置返回 undefined
|
|
331
|
+
*/
|
|
332
|
+
private getCompactModel;
|
|
348
333
|
/**
|
|
349
334
|
* 生成场景化压缩提示 (Compact Hint)
|
|
350
335
|
*
|
|
@@ -408,12 +393,44 @@ export declare class SessionComponent extends BaseComponent {
|
|
|
408
393
|
previewCompact(sessionId: string): Promise<CompactPreview>;
|
|
409
394
|
/**
|
|
410
395
|
* Get all checkpoints for a session
|
|
396
|
+
*
|
|
397
|
+
* ★ C 方案:旧格式(五栏位)读时适配为新格式(content),
|
|
398
|
+
* 不写回数据库(lazy adapter)。
|
|
411
399
|
*/
|
|
412
400
|
getCheckpoints(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
413
401
|
/**
|
|
414
402
|
* Get a specific checkpoint
|
|
403
|
+
*
|
|
404
|
+
* ★ C 方案:旧格式读时适配(见 getCheckpoints)。
|
|
415
405
|
*/
|
|
416
406
|
getCheckpoint(sessionId: string, checkpointId: string): Promise<SessionCheckpoint | undefined>;
|
|
407
|
+
/**
|
|
408
|
+
* 读取 checkpoint 的**原始存储形态**(不做适配)。
|
|
409
|
+
*
|
|
410
|
+
* 用途:存量 checkpoint 检查脚本 / adaptStoredCheckpoints 内部统计 ——
|
|
411
|
+
* 需要区分「库里到底存的是旧格式还是新格式」。
|
|
412
|
+
*/
|
|
413
|
+
readStoredCheckpointsRaw(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
414
|
+
/**
|
|
415
|
+
* 存量 checkpoint 适配(C 方案 Task #4933)。
|
|
416
|
+
*
|
|
417
|
+
* 生产库有 555 个旧格式 checkpoint(五栏位,无 content)。默认**读时适配**
|
|
418
|
+
* 已能让新代码无感知;本方法提供**显式迁移**能力(把旧格式写回新格式)。
|
|
419
|
+
*
|
|
420
|
+
* ⚠️ 默认 dry-run(`apply: false`):只统计 + 抽样,不写数据库。
|
|
421
|
+
* ⚠️ `apply: true` 会重写 session.metadata —— 如果 roy-agent daemon 正在运行
|
|
422
|
+
* 并持有 sessions.db 的内存缓存,外部进程的写入可能被 daemon 的后续
|
|
423
|
+
* saveCheckpoint 覆盖。建议在 daemon 重启后(或停机时)执行。
|
|
424
|
+
*/
|
|
425
|
+
adaptStoredCheckpoints(sessionId: string, options?: {
|
|
426
|
+
apply?: boolean;
|
|
427
|
+
}): Promise<CheckpointAdaptReport>;
|
|
428
|
+
/**
|
|
429
|
+
* 把一组 checkpoint 整体写回 session.metadata.checkpointDetails。
|
|
430
|
+
*
|
|
431
|
+
* 只做「按 id 覆盖」,不动 checkpoints 索引里的 meta(id/title/createdAt 不变)。
|
|
432
|
+
*/
|
|
433
|
+
private writeCheckpointsBack;
|
|
417
434
|
/**
|
|
418
435
|
* Delete a checkpoint and restore archived messages
|
|
419
436
|
*/
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
SQLiteSessionStore,
|
|
4
4
|
getDefaultDataDir,
|
|
5
5
|
getDefaultSessionDbPath
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-0qyrk5k0.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
|
|
11
11
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
@@ -92,6 +92,14 @@ export declare class SQLiteSessionStore extends BaseSessionStore {
|
|
|
92
92
|
getMessageIndexes(sessionId: string, role: string): Promise<number[]>;
|
|
93
93
|
saveCheckpoint(sessionId: string, checkpoint: SessionCheckpoint): Promise<void>;
|
|
94
94
|
getCheckpoints(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
95
|
+
/**
|
|
96
|
+
* 按 id 覆盖写回一组 checkpoint 明细(Task #4933 存量格式迁移用)。
|
|
97
|
+
*
|
|
98
|
+
* 只改 `metadata.checkpointDetails`,不动 `metadata.checkpoints` 索引
|
|
99
|
+
* (id / title / messageIndex / createdAt 都是不变的元数据)。
|
|
100
|
+
* 返回是否有任何变更被写入。
|
|
101
|
+
*/
|
|
102
|
+
replaceCheckpointDetails(sessionId: string, checkpoints: SessionCheckpoint[]): Promise<boolean>;
|
|
95
103
|
getCheckpoint(sessionId: string, checkpointId: string): Promise<SessionCheckpoint | undefined>;
|
|
96
104
|
deleteCheckpoint(sessionId: string, checkpointId: string): Promise<boolean>;
|
|
97
105
|
archiveMessages(sessionId: string, checkpointId: string, beforeIndex: number): Promise<number>;
|
|
@@ -83,10 +83,6 @@ export interface CheckpointMeta {
|
|
|
83
83
|
createdAt: number;
|
|
84
84
|
type: CheckpointType;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
* User Intent type - represents a user's intent extracted from conversation
|
|
88
|
-
*/
|
|
89
|
-
export type UserIntent = string;
|
|
90
86
|
/**
|
|
91
87
|
* Recent message for checkpoint
|
|
92
88
|
*
|
|
@@ -100,14 +96,18 @@ export interface RecentMessage {
|
|
|
100
96
|
* Complete checkpoint information (includes generated content)
|
|
101
97
|
*/
|
|
102
98
|
export interface SessionCheckpoint extends CheckpointMeta {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
/**
|
|
100
|
+
* ★ C 方案(Task #4933 重写):整段自然语言 checkpoint 正文。
|
|
101
|
+
*
|
|
102
|
+
* 用户决策:压缩产物不再结构化 —— 没有 summary /
|
|
103
|
+
* processKeyPoints / currentState / nextSteps / userIntents 五栏位,
|
|
104
|
+
* 也没有固定 markdown 小节契约。正文形式自由(段落/列表/代码块都行)。
|
|
105
|
+
*
|
|
106
|
+
* 旧格式存量数据(生产 555 个)由 adaptLegacyCheckpoint()
|
|
107
|
+
* 在读取时合成 content,不写回数据库。
|
|
108
|
+
*/
|
|
109
|
+
content: string;
|
|
107
110
|
messageCountBefore: number;
|
|
108
|
-
metadata?: Record<string, unknown>;
|
|
109
|
-
/** User intents extracted from the conversation */
|
|
110
|
-
userIntents: UserIntent[];
|
|
111
111
|
/**
|
|
112
112
|
* Recent messages preserved from the compacted conversation
|
|
113
113
|
*
|
|
@@ -378,16 +378,10 @@ export interface CheckpointPart {
|
|
|
378
378
|
type: "checkpoint";
|
|
379
379
|
/** Checkpoint ID reference */
|
|
380
380
|
checkpointId: string;
|
|
381
|
-
/**
|
|
381
|
+
/** Checkpoint content (整段自然语言正文) */
|
|
382
382
|
content: string;
|
|
383
383
|
/** Title of the checkpoint */
|
|
384
384
|
title?: string;
|
|
385
|
-
/** Process key points */
|
|
386
|
-
processKeyPoints?: string[];
|
|
387
|
-
/** Current state description */
|
|
388
|
-
currentState?: string;
|
|
389
|
-
/** Next steps */
|
|
390
|
-
nextSteps?: string[];
|
|
391
385
|
/** Number of messages that were compacted */
|
|
392
386
|
messageCountBefore?: number;
|
|
393
387
|
/** Creation timestamp */
|
|
@@ -515,30 +509,27 @@ export interface AddMessageOptions {
|
|
|
515
509
|
}
|
|
516
510
|
/**
|
|
517
511
|
* Options for compact operation
|
|
512
|
+
*
|
|
513
|
+
* ★ Task #4933(C 方案):只剩 `scenarioHint` 一个语义字段。
|
|
514
|
+
* 旧的 processKeyPoints / currentState / nextSteps 三栏位 hint 已删除
|
|
515
|
+
* (它们是「五栏位结构化」时代的遗留 —— C 方案下压缩产物是整段自然语言,
|
|
516
|
+
* 用户/CLI 再拼装结构化栏位没有意义,且会让后续开发者误以为五栏位仍是契约)。
|
|
517
|
+
* `summary` 同样未在 compact() 中被读取(HEAD 之前即如此),一并移除。
|
|
518
518
|
*/
|
|
519
519
|
export interface CompactOptions {
|
|
520
|
-
/** User-provided summary hint for checkpoint generation */
|
|
521
|
-
summary?: string;
|
|
522
|
-
/** User-provided process key points hint */
|
|
523
|
-
processKeyPoints?: string[];
|
|
524
|
-
/** User-provided current state hint */
|
|
525
|
-
currentState?: string;
|
|
526
|
-
/** User-provided next steps hint */
|
|
527
|
-
nextSteps?: string[];
|
|
528
520
|
/** Whether this is auto-triggered compact */
|
|
529
521
|
auto?: boolean;
|
|
530
522
|
/**
|
|
531
523
|
* Scenario hint for guiding checkpoint generation
|
|
532
524
|
*
|
|
533
525
|
* A natural language description that provides context about the current scenario.
|
|
534
|
-
* This helps the
|
|
535
|
-
* situation. Examples:
|
|
526
|
+
* This helps the checkpoint generator produce more relevant content based on the
|
|
527
|
+
* specific situation. Examples:
|
|
536
528
|
* - "Task execution in progress: implementing feature X, current working directory is /path/to/project"
|
|
537
529
|
* - "Bug investigation: analyzing crash dump, current hypothesis is memory corruption"
|
|
538
530
|
* - "Code review session: reviewing PR #123, focus on security implications"
|
|
539
531
|
*
|
|
540
|
-
* When provided,
|
|
541
|
-
* generation with scenario-specific emphasis.
|
|
532
|
+
* When provided, it is injected into the compact agent's query as a focus hint.
|
|
542
533
|
*/
|
|
543
534
|
scenarioHint?: string;
|
|
544
535
|
}
|
|
@@ -559,6 +550,30 @@ export interface CompactPreview {
|
|
|
559
550
|
estimatedCheckpointTokens: number;
|
|
560
551
|
wouldTrigger: boolean;
|
|
561
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* 存量 checkpoint 适配报告(Task #4933 C 方案)
|
|
555
|
+
*
|
|
556
|
+
* 生产库有 555 个旧格式 checkpoint(五栏位,无 content)。
|
|
557
|
+
* `adaptStoredCheckpoints()` 默认 dry-run,返回本报告用于人工核对。
|
|
558
|
+
*/
|
|
559
|
+
export interface CheckpointAdaptReport {
|
|
560
|
+
sessionId: string;
|
|
561
|
+
/** checkpoint 总数 */
|
|
562
|
+
total: number;
|
|
563
|
+
/** 旧格式(无 content)数量 */
|
|
564
|
+
legacy: number;
|
|
565
|
+
/** 新格式(已有 content)数量 */
|
|
566
|
+
modern: number;
|
|
567
|
+
/** 实际写回的数量(dry-run 时恒为 0) */
|
|
568
|
+
applied: number;
|
|
569
|
+
/** 抽样(最多 3 条),用于人工确认合成正文质量 */
|
|
570
|
+
samples: Array<{
|
|
571
|
+
id: string;
|
|
572
|
+
title: string;
|
|
573
|
+
contentLength: number;
|
|
574
|
+
contentPreview: string;
|
|
575
|
+
}>;
|
|
576
|
+
}
|
|
562
577
|
/**
|
|
563
578
|
* Options for getting session context
|
|
564
579
|
*/
|
|
@@ -122,6 +122,14 @@ export interface BackgroundTaskAskUserPayload {
|
|
|
122
122
|
nodeId: string;
|
|
123
123
|
nodeType: string;
|
|
124
124
|
agentSessionId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* ★ Task #4983 — 问题**是否已投递到用户渠道**(工具层判定)。
|
|
127
|
+
*
|
|
128
|
+
* - `true` → ask_user 工具已经把问题正文发到 IM 渠道,用户已看到 ⇒
|
|
129
|
+
* 主 agent 那一轮**不得**再发(否则用户收到两条)。
|
|
130
|
+
* - `false` → 工具层没投成(没有 replyChannel / 投递失败)⇒ 需要兜底投递。
|
|
131
|
+
*/
|
|
132
|
+
delivered?: boolean;
|
|
125
133
|
/** 原始 __ASK_USER_ERROR__:... 错误字符串(备份,便于诊断) */
|
|
126
134
|
error: string;
|
|
127
135
|
executionTimeMs: number;
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
deriveTriggerEventIdFromEnvContext,
|
|
13
13
|
getSubAgentSpec,
|
|
14
14
|
handleBackgroundTask
|
|
15
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
15
|
+
} from "../../../shared/@ai-setting/roy-agent-core-jg65qnwa.js";
|
|
16
16
|
import"../../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
17
17
|
import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
18
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
import"../../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
19
19
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
20
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
21
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
20
|
+
import"../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
21
|
+
import"../../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
22
22
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
23
23
|
import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
24
24
|
import"../../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
BackgroundTaskEventTypes,
|
|
6
6
|
BackgroundTaskManager,
|
|
7
7
|
createDelegateTool
|
|
8
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../../shared/@ai-setting/roy-agent-core-jg65qnwa.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
11
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
13
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
14
|
+
import"../../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
15
15
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
16
16
|
import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
17
17
|
import"../../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,27 +5,27 @@ import {
|
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum,
|
|
7
7
|
TaskTypeEnum
|
|
8
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
9
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../shared/@ai-setting/roy-agent-core-4gr3k7qg.js";
|
|
9
|
+
import"../../shared/@ai-setting/roy-agent-core-2akfd64z.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
11
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-jg65qnwa.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
|
|
14
14
|
import {
|
|
15
15
|
TaskEntityEventTypes
|
|
16
16
|
} from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
import"../../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
20
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
20
|
+
import"../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
21
21
|
import {
|
|
22
22
|
SQLiteTaskStore,
|
|
23
23
|
getDefaultTaskDbPath
|
|
24
24
|
} from "../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
27
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
28
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
27
|
+
import"../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
28
|
+
import"../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
|
|
29
29
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
30
30
|
import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
31
31
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
searchTasksTool,
|
|
7
7
|
treeTasksTool,
|
|
8
8
|
updateTaskTool
|
|
9
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "../../../shared/@ai-setting/roy-agent-core-hnyk1by7.js";
|
|
10
10
|
import {
|
|
11
11
|
createOperationTool,
|
|
12
12
|
listOperationsTool
|
|
13
13
|
} from "../../../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
14
14
|
import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
15
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
15
|
+
import"../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
16
16
|
import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
|
|
17
17
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
18
18
|
import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
export { TaskTagPlugin } from "./task-tag-plugin";
|
|
5
5
|
export { LayaDecisionPlugin, createLayaDecisionPlugin, LAYA_REUSE_THRESHOLD, type LayaDecisionPluginOptions, } from "./laya-decision-plugin";
|
|
6
6
|
export { createAutoTaskPlugin, type AutoTaskPluginConfig, } from "./auto-task-plugin";
|
|
7
|
+
export { LayaCompletionPlugin, createLayaCompletionPlugin, registerLayaCompletionTaskHook, buildCompletionHint, renderCompletionState, buildCompletionQuestion, LAYA_COMPLETION_THRESHOLD, type LayaCompletionPluginOptions, } from "./laya-completion-plugin";
|
|
8
|
+
export { TASK_COMPLETION_HINT_ANCHOR, TASK_COMPLETE_ITEM_BY_ITEM, TASK_COMPLETE_VERIFY_DUTY, TASK_COMPLETE_ACCEPTANCE, } from "../tools/completion-copy";
|
|
9
|
+
export type { DecisionPort, DecisionRequest, DecisionAnswer, DecisionResponse, } from "./decision-port";
|
|
7
10
|
export { WORKFLOW_EXTRACTOR_PROMPT, formatExtractorInput, formatExtractorInputFromDescription, parseExtractorOutput, } from "./workflow-extractor-agent";
|
|
8
11
|
export { LarkCliTaskNotifyHook, createLarkCliTaskNotifyHook, type TaskNotifyConfig, NotifyType, } from "./lark-cli-task-notify-plugin";
|
|
9
12
|
export { PerTaskGroupChatPlugin, createPerTaskGroupChatPlugin, type PerTaskGroupConfig, } from "./per-task-group-chat-plugin";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
LAYA_COMPLETION_THRESHOLD,
|
|
2
3
|
LAYA_REUSE_THRESHOLD,
|
|
3
4
|
LarkCliTaskNotifyHook,
|
|
5
|
+
LayaCompletionPlugin,
|
|
4
6
|
LayaDecisionPlugin,
|
|
5
7
|
MemoryLarkCardStateStore,
|
|
6
8
|
NotifyType,
|
|
@@ -8,22 +10,32 @@ import {
|
|
|
8
10
|
SqliteLarkCardStateStore,
|
|
9
11
|
TaskTagPlugin,
|
|
10
12
|
WORKFLOW_EXTRACTOR_PROMPT,
|
|
13
|
+
buildCompletionHint,
|
|
14
|
+
buildCompletionQuestion,
|
|
11
15
|
createAutoTaskPlugin,
|
|
12
16
|
createLarkCardStateStore,
|
|
13
17
|
createLarkCliTaskNotifyHook,
|
|
18
|
+
createLayaCompletionPlugin,
|
|
14
19
|
createLayaDecisionPlugin,
|
|
15
20
|
createPerTaskGroupChatPlugin,
|
|
16
21
|
formatExtractorInput,
|
|
17
22
|
formatExtractorInputFromDescription,
|
|
18
23
|
getDefaultLarkCardDbPath,
|
|
19
|
-
parseExtractorOutput
|
|
20
|
-
|
|
24
|
+
parseExtractorOutput,
|
|
25
|
+
registerLayaCompletionTaskHook,
|
|
26
|
+
renderCompletionState
|
|
27
|
+
} from "../../../shared/@ai-setting/roy-agent-core-y7x2qzwc.js";
|
|
21
28
|
import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
22
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
29
|
+
import"../../../shared/@ai-setting/roy-agent-core-3e6gg17d.js";
|
|
23
30
|
import"../../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
24
31
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
25
32
|
import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
26
|
-
import
|
|
33
|
+
import {
|
|
34
|
+
TASK_COMPLETE_ACCEPTANCE,
|
|
35
|
+
TASK_COMPLETE_ITEM_BY_ITEM,
|
|
36
|
+
TASK_COMPLETE_VERIFY_DUTY,
|
|
37
|
+
TASK_COMPLETION_HINT_ANCHOR
|
|
38
|
+
} from "../../../shared/@ai-setting/roy-agent-core-11shp00p.js";
|
|
27
39
|
import {
|
|
28
40
|
DEFAULT_APP_LINK_BASE,
|
|
29
41
|
LarkCardPatchNotifier,
|
|
@@ -42,12 +54,12 @@ import {
|
|
|
42
54
|
renderWorkflowInfoLines,
|
|
43
55
|
resolveTaskTitleForDisplay,
|
|
44
56
|
sanitizeInlineText
|
|
45
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
46
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
47
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
48
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
57
|
+
} from "../../../shared/@ai-setting/roy-agent-core-nmx9934r.js";
|
|
58
|
+
import"../../../shared/@ai-setting/roy-agent-core-1v4g0d4x.js";
|
|
59
|
+
import"../../../shared/@ai-setting/roy-agent-core-cgtq6427.js";
|
|
60
|
+
import"../../../shared/@ai-setting/roy-agent-core-er070zjq.js";
|
|
49
61
|
import"../../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
50
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
62
|
+
import"../../../shared/@ai-setting/roy-agent-core-mkc3zshb.js";
|
|
51
63
|
import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
52
64
|
import"../../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
|
|
53
65
|
import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
|
|
@@ -64,6 +76,8 @@ export {
|
|
|
64
76
|
renderProcessSteps,
|
|
65
77
|
renderMilestones,
|
|
66
78
|
renderContextAsLines,
|
|
79
|
+
renderCompletionState,
|
|
80
|
+
registerLayaCompletionTaskHook,
|
|
67
81
|
parseExtractorOutput,
|
|
68
82
|
humanizeValue,
|
|
69
83
|
getDefaultLarkCardDbPath,
|
|
@@ -74,21 +88,30 @@ export {
|
|
|
74
88
|
formatDateTimeForDisplay,
|
|
75
89
|
createPerTaskGroupChatPlugin,
|
|
76
90
|
createLayaDecisionPlugin,
|
|
91
|
+
createLayaCompletionPlugin,
|
|
77
92
|
createLarkCliTaskNotifyHook,
|
|
78
93
|
createLarkCardStateStore,
|
|
79
94
|
createAutoTaskPlugin,
|
|
80
95
|
buildWorkflowCard,
|
|
81
96
|
buildTaskCard,
|
|
97
|
+
buildCompletionQuestion,
|
|
98
|
+
buildCompletionHint,
|
|
82
99
|
buildChatAppLink,
|
|
83
100
|
WORKFLOW_EXTRACTOR_PROMPT,
|
|
84
101
|
TaskTagPlugin,
|
|
102
|
+
TASK_COMPLETION_HINT_ANCHOR,
|
|
103
|
+
TASK_COMPLETE_VERIFY_DUTY,
|
|
104
|
+
TASK_COMPLETE_ITEM_BY_ITEM,
|
|
105
|
+
TASK_COMPLETE_ACCEPTANCE,
|
|
85
106
|
SqliteLarkCardStateStore,
|
|
86
107
|
PerTaskGroupChatPlugin,
|
|
87
108
|
NotifyType,
|
|
88
109
|
MemoryLarkCardStateStore,
|
|
89
110
|
LayaDecisionPlugin,
|
|
111
|
+
LayaCompletionPlugin,
|
|
90
112
|
LarkCliTaskNotifyHook,
|
|
91
113
|
LarkCardPatchNotifier,
|
|
92
114
|
LAYA_REUSE_THRESHOLD,
|
|
115
|
+
LAYA_COMPLETION_THRESHOLD,
|
|
93
116
|
DEFAULT_APP_LINK_BASE
|
|
94
117
|
};
|
|
@@ -379,6 +379,27 @@ export declare function formatTimestampForDisplay(iso: string | undefined): stri
|
|
|
379
379
|
* 路径 / 命令 / 中文正文不受影响。
|
|
380
380
|
*/
|
|
381
381
|
export declare function sanitizeInlineText(text: string, maxLen?: number): string;
|
|
382
|
+
/**
|
|
383
|
+
* 卡片 head 标题的**视觉宽度预算**(Task #4984)
|
|
384
|
+
*
|
|
385
|
+
* 飞书卡片 header.title 是单行 plain_text,超长会被截断/挤压布局。
|
|
386
|
+
* 这里用「视觉宽度」而非字符数做预算:CJK 占 2 列、ASCII 占 1 列。
|
|
387
|
+
*/
|
|
388
|
+
export declare const HEAD_TITLE_MAX_WIDTH = 40;
|
|
389
|
+
/**
|
|
390
|
+
* 截断卡片 head 用的任务名称(Task #4984)
|
|
391
|
+
*
|
|
392
|
+
* 策略(按用户诉求「head 要有任务名称,但别撑破布局」):
|
|
393
|
+
* 1. 先把多行压成单行(head 是单行 plain_text)
|
|
394
|
+
* 2. **视觉宽度**预算:CJK 记 2 列、ASCII 记 1 列
|
|
395
|
+
* 3. 不切半个 emoji —— 按 code point 遍历,代理对整体保留
|
|
396
|
+
* 4. 不切半个英文单词 —— 尽量在空格/分隔符处断开
|
|
397
|
+
* 5. 超长时补 "…" 后缀
|
|
398
|
+
*
|
|
399
|
+
* @param text 原始标题
|
|
400
|
+
* @param maxWidth 视觉宽度预算(默认 {@link HEAD_TITLE_MAX_WIDTH})
|
|
401
|
+
*/
|
|
402
|
+
export declare function truncateHeadTitle(text: string | undefined | null, maxWidth?: number): string;
|
|
382
403
|
/** ISO 8601 时间串 → 北京时间 "YYYY-MM-DD HH:mm"(非 ISO 时原样返回) */
|
|
383
404
|
export declare function formatDateTimeForDisplay(value: string): string;
|
|
384
405
|
/**
|
|
@@ -677,6 +698,28 @@ export declare class LarkCardPatchNotifier {
|
|
|
677
698
|
* ★ 幂等:已有 state 时不覆盖(内存里的比持久化的更新)。
|
|
678
699
|
*/
|
|
679
700
|
hydrateState(messageId: string, snapshot: CardStateSnapshot): void;
|
|
701
|
+
/**
|
|
702
|
+
* ★ Task #5020 —— 把时间线条目**并入内存态**,但**不发** lark-cli patch。
|
|
703
|
+
*
|
|
704
|
+
* ## 为什么需要
|
|
705
|
+
*
|
|
706
|
+
* `task:operation:after.create` 的 patch 频率受 `operationThrottleMs`
|
|
707
|
+
* 约束(默认 5s),目的是别刷屏飞书。但**节流不该丢数据**:
|
|
708
|
+
* 被节流的那条 operation 如果直接丢掉,它的里程碑既不上卡也不落库。
|
|
709
|
+
*
|
|
710
|
+
* 这个方法让「节流」与「数据完整性」解耦:
|
|
711
|
+
* - 被节流的 operation → `mergeTimelineState`(只进内存态,不 patch)
|
|
712
|
+
* - 下一次允许 patch → `updateTask` 把**累积后的**整条时间线 patch 出去
|
|
713
|
+
* - 任何时刻的 `exportState` 都能看到**全部**里程碑 → ledger 落库完整
|
|
714
|
+
*
|
|
715
|
+
* ## 与 `updateTask` 的区别
|
|
716
|
+
*
|
|
717
|
+
* `updateTask` 会**渲染并发送**卡片(一次 lark-cli 调用);本方法**不碰飞书**,
|
|
718
|
+
* 只动内存态。调用方负责决定何时真正 patch。
|
|
719
|
+
*
|
|
720
|
+
* @returns 是否真的并入了(state 不存在时返回 false —— 那张卡不是本 notifier 的)
|
|
721
|
+
*/
|
|
722
|
+
mergeTimelineState(messageId: string, milestones?: Milestone[], processSteps?: ProcessStep[]): boolean;
|
|
680
723
|
/**
|
|
681
724
|
* 暂停卡片(Task #4536:stop / archived)+ unpin,**保留**卡片状态与时间线
|
|
682
725
|
*
|
|
@@ -744,6 +787,24 @@ export declare class LarkCardPatchNotifier {
|
|
|
744
787
|
updateMetaAndBuildCard(messageId: string, meta: TaskMeta, opts?: {
|
|
745
788
|
clearPerTaskChat?: boolean;
|
|
746
789
|
}): CardPayload | undefined;
|
|
790
|
+
/**
|
|
791
|
+
* ★ Task #5020 —— 已经走到**真终态**的卡片(review round-4 MAJOR)。
|
|
792
|
+
*
|
|
793
|
+
* ## 为什么需要(结构性地堵住竞态,而不是靠时序检查)
|
|
794
|
+
*
|
|
795
|
+
* `finishTask` 结束后会 `states.delete(messageId)`。此时若有**另一个**
|
|
796
|
+
* 已经通过前置检查、正在等 mutex 的 `updateTask` 排队进来,它会因为
|
|
797
|
+
* 「state 不存在」而用空默认 state 重建卡片 → 把「已完成」刷回「进行中」
|
|
798
|
+
* 且清空里程碑。
|
|
799
|
+
*
|
|
800
|
+
* 前置检查(`cardMessageIds` / ledger status)只能挡住**还没开始**的补发;
|
|
801
|
+
* 已经进入 `mutexFor(messageId)` 队列的那一个挡不住。所以必须在
|
|
802
|
+
* notifier 内部——也就是唯一串行化那一步——做终态守卫。
|
|
803
|
+
*
|
|
804
|
+
* 记 messageId 而不是 taskId:reopen 场景会发一张**新卡**(新 messageId),
|
|
805
|
+
* 不会被旧 messageId 的终态记录误伤。
|
|
806
|
+
*/
|
|
807
|
+
private finalisedCards;
|
|
747
808
|
/** 诊断:当前跟踪中的卡片数(测试/自检用) */
|
|
748
809
|
trackedCardCount(): number;
|
|
749
810
|
/** 诊断:当前跟踪中的 workflow 卡片数(测试/自检用) */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_APP_LINK_BASE,
|
|
3
|
+
HEAD_TITLE_MAX_WIDTH,
|
|
3
4
|
LarkCardPatchNotifier,
|
|
4
5
|
buildChatAppLink,
|
|
5
6
|
buildCollapsiblePanel,
|
|
@@ -19,13 +20,15 @@ import {
|
|
|
19
20
|
renderTaskInfoLines,
|
|
20
21
|
renderWorkflowInfoLines,
|
|
21
22
|
resolveTaskTitleForDisplay,
|
|
22
|
-
sanitizeInlineText
|
|
23
|
-
|
|
23
|
+
sanitizeInlineText,
|
|
24
|
+
truncateHeadTitle
|
|
25
|
+
} from "../../../shared/@ai-setting/roy-agent-core-nmx9934r.js";
|
|
24
26
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
25
27
|
import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
26
28
|
import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
|
|
27
29
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
28
30
|
export {
|
|
31
|
+
truncateHeadTitle,
|
|
29
32
|
sanitizeInlineText,
|
|
30
33
|
resolveTaskTitleForDisplay,
|
|
31
34
|
renderWorkflowInfoLines,
|
|
@@ -46,5 +49,6 @@ export {
|
|
|
46
49
|
buildCollapsiblePanel,
|
|
47
50
|
buildChatAppLink,
|
|
48
51
|
LarkCardPatchNotifier,
|
|
52
|
+
HEAD_TITLE_MAX_WIDTH,
|
|
49
53
|
DEFAULT_APP_LINK_BASE
|
|
50
54
|
};
|