@ai-setting/roy-agent-core 1.7.71 → 1.7.72
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 +2 -2
- package/dist/env/agent/index.js +2 -2
- package/dist/env/agent/summary-agent.d.ts +6 -15
- package/dist/env/agent/types.d.ts +0 -17
- package/dist/env/event-source/event-source-handlers.js +3 -3
- package/dist/env/event-source/index.js +4 -4
- package/dist/env/index.js +15 -16
- package/dist/env/llm/index.js +1 -1
- package/dist/env/llm/temperature-policy.d.ts +107 -0
- package/dist/env/llm/types.d.ts +2 -2
- package/dist/env/prompt/index.js +2 -2
- package/dist/env/prompt/prompts-index.d.ts +2 -2
- 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 +2 -3
- package/dist/env/session/session-component.d.ts +47 -30
- package/dist/env/session/storage/index.js +1 -1
- 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.js +3 -3
- package/dist/env/task/delegate/index.js +3 -3
- package/dist/env/task/index.js +4 -4
- package/dist/env/task/plugins/index.js +2 -2
- package/dist/env/workflow/engine/index.js +2 -3
- package/dist/env/workflow/index.js +6 -7
- package/dist/env/workflow/tools/index.js +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -18
- package/dist/shared/@ai-setting/{roy-agent-core-1gsbqesr.js → roy-agent-core-1p6syv85.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-mwa6apzx.js → roy-agent-core-2gzt2q8c.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9geem94g.js → roy-agent-core-34jz9mgh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-k13pxrpk.js → roy-agent-core-5gw0qa8m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-101qtkyc.js → roy-agent-core-7qvw65jt.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-002g6nfk.js → roy-agent-core-attpry6g.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-37tj4y6a.js → roy-agent-core-gr48c89p.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-0cb6w0k7.js → roy-agent-core-hfyfavp3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hfr6bzts.js → roy-agent-core-jgb3bb42.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9bshyqjn.js → roy-agent-core-pakhchy7.js} +183 -132
- package/dist/shared/@ai-setting/{roy-agent-core-02j24hrg.js → roy-agent-core-rxb00gjm.js} +70 -3
- package/dist/shared/@ai-setting/{roy-agent-core-8cx7cfdg.js → roy-agent-core-skyc30qx.js} +1 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hy3zn2q2.js → roy-agent-core-sm0sf6sb.js} +20 -0
- package/dist/shared/@ai-setting/{roy-agent-core-mw2cen6s.js → roy-agent-core-vah6g5yx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-07fvy74y.js → roy-agent-core-vm8h5zyj.js} +20 -6
- package/dist/shared/@ai-setting/{roy-agent-core-5repth1n.js → roy-agent-core-wr7mv7k3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zsbh9bfv.js → roy-agent-core-y12kyxwa.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zv8bswpw.js → roy-agent-core-yhwxpj12.js} +33 -19
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +0 -37
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
filterToolsByAgent,
|
|
8
8
|
parseToolList,
|
|
9
9
|
toLLMMessage
|
|
10
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-jgb3bb42.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-dt104qa1.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-vm8h5zyj.js";
|
|
14
14
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-kmbct9yg.js";
|
package/dist/env/agent/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
AgentComponent,
|
|
6
6
|
AgentComponentConfigSchema
|
|
7
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
+
} from "../../shared/@ai-setting/roy-agent-core-jgb3bb42.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-dt104qa1.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
10
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../shared/@ai-setting/roy-agent-core-vm8h5zyj.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
12
12
|
import"../../shared/@ai-setting/roy-agent-core-f77k3gqt.js";
|
|
13
13
|
import"../../shared/@ai-setting/roy-agent-core-kmbct9yg.js";
|
|
@@ -15,8 +15,12 @@ import type { LLMComponent } from "../llm/llm";
|
|
|
15
15
|
* SessionComponent.generateCompactHint() using AgentComponent.run("compact-hint", ...).
|
|
16
16
|
*
|
|
17
17
|
* This class is retained for backward compatibility with existing tests
|
|
18
|
-
* (
|
|
19
|
-
*
|
|
18
|
+
* (see invoke-threshold-check.test.ts). It no longer contains any active logic.
|
|
19
|
+
*
|
|
20
|
+
* Note: its former `parseCompactJsonResponse()` helper and the
|
|
21
|
+
* `SummaryAgentResult` type were removed in Task #4933 — they encoded the
|
|
22
|
+
* five-field JSON checkpoint extraction that was explicitly rejected; the
|
|
23
|
+
* checkpoint is now a single natural-language `content` string.
|
|
20
24
|
*/
|
|
21
25
|
export declare class SummaryAgent {
|
|
22
26
|
private llmComponent;
|
|
@@ -29,16 +33,3 @@ export declare class SummaryAgent {
|
|
|
29
33
|
* 纯函数,可独立测试
|
|
30
34
|
*/
|
|
31
35
|
export declare function parseCompactHintResponse(content: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* 解析 JSON 响应(用于 Phase 2 compact agent 输出解析)
|
|
34
|
-
*
|
|
35
|
-
* 从 SessionComponent.compact() 中解析 compact agent 返回的 JSON。
|
|
36
|
-
* 纯函数,方便测试。
|
|
37
|
-
*/
|
|
38
|
-
export declare function parseCompactJsonResponse(content: string): {
|
|
39
|
-
title: string;
|
|
40
|
-
processKeyPoints: string[];
|
|
41
|
-
currentState: string;
|
|
42
|
-
nextSteps: string[];
|
|
43
|
-
userIntents: string[];
|
|
44
|
-
};
|
|
@@ -484,23 +484,6 @@ export interface SummaryAgentRunOptions {
|
|
|
484
484
|
*/
|
|
485
485
|
scenarioHint?: string;
|
|
486
486
|
}
|
|
487
|
-
/**
|
|
488
|
-
* Summary Agent 运行结果
|
|
489
|
-
*/
|
|
490
|
-
export interface SummaryAgentResult {
|
|
491
|
-
/** Checkpoint 标题 */
|
|
492
|
-
title: string;
|
|
493
|
-
/** 过程要点 */
|
|
494
|
-
processKeyPoints: string[];
|
|
495
|
-
/** 当前状态 */
|
|
496
|
-
currentState: string;
|
|
497
|
-
/** 后续待跟进 */
|
|
498
|
-
nextSteps: string[];
|
|
499
|
-
/** 用户意图列表 - 从对话中提取的用户相关意图 */
|
|
500
|
-
userIntents: string[];
|
|
501
|
-
/** 原始 LLM 响应 */
|
|
502
|
-
rawResponse?: string;
|
|
503
|
-
}
|
|
504
487
|
/**
|
|
505
488
|
* Compact Hint 生成选项
|
|
506
489
|
*
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
patchCardByLarkCli,
|
|
12
12
|
renderRuleNoticeSection,
|
|
13
13
|
timerHandler
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "../../shared/@ai-setting/roy-agent-core-y12kyxwa.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-bxkjk7zx.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
17
17
|
import {
|
|
18
18
|
cliCommandHandler
|
|
19
19
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-5gw0qa8m.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-yhwxpj12.js";
|
|
24
24
|
import"../../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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import"../../shared/@ai-setting/roy-agent-core-b4x6x4k2.js";
|
|
2
2
|
import {
|
|
3
3
|
EventSourceComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-wr7mv7k3.js";
|
|
5
5
|
import {
|
|
6
6
|
BountyIMInstance,
|
|
7
7
|
COMMAND_PREFIX,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
timerHandler,
|
|
34
34
|
translateCardActionToCommand,
|
|
35
35
|
writeFallbackModelList
|
|
36
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
36
|
+
} from "../../shared/@ai-setting/roy-agent-core-y12kyxwa.js";
|
|
37
37
|
import {
|
|
38
38
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
39
39
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -52,14 +52,14 @@ import {
|
|
|
52
52
|
parseCliSessionChatId
|
|
53
53
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
54
54
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
55
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
55
|
+
import"../../shared/@ai-setting/roy-agent-core-5gw0qa8m.js";
|
|
56
56
|
import {
|
|
57
57
|
EventStoreImpl,
|
|
58
58
|
getSharedEventStore,
|
|
59
59
|
resetSharedEventStore,
|
|
60
60
|
setSharedEventStore
|
|
61
61
|
} from "../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
62
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
62
|
+
import"../../shared/@ai-setting/roy-agent-core-yhwxpj12.js";
|
|
63
63
|
import"../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
64
64
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
65
65
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
package/dist/env/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-1p6syv85.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskComponent
|
|
6
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../shared/@ai-setting/roy-agent-core-2gzt2q8c.js";
|
|
7
7
|
import"../shared/@ai-setting/roy-agent-core-58804s3j.js";
|
|
8
8
|
import"../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
9
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
import"../shared/@ai-setting/roy-agent-core-7qvw65jt.js";
|
|
10
10
|
import"../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
11
11
|
import"../shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
|
|
12
12
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
@@ -14,11 +14,11 @@ import"../shared/@ai-setting/roy-agent-core-7sj9xs9c.js";
|
|
|
14
14
|
import"../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
15
15
|
import {
|
|
16
16
|
EventSourceComponent
|
|
17
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../shared/@ai-setting/roy-agent-core-wr7mv7k3.js";
|
|
18
18
|
import {
|
|
19
19
|
builtInHandlers,
|
|
20
20
|
larkCliHandler
|
|
21
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
} from "../shared/@ai-setting/roy-agent-core-y12kyxwa.js";
|
|
22
22
|
import {
|
|
23
23
|
EventSourceInitHooks,
|
|
24
24
|
getDefaultConfigForType,
|
|
@@ -29,9 +29,9 @@ import {
|
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
31
31
|
import"../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
32
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
32
|
+
import"../shared/@ai-setting/roy-agent-core-5gw0qa8m.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
34
|
+
import"../shared/@ai-setting/roy-agent-core-yhwxpj12.js";
|
|
35
35
|
import"../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
36
36
|
import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
37
37
|
import"../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
@@ -40,21 +40,20 @@ import"../shared/@ai-setting/roy-agent-core-1w9y7mxj.js";
|
|
|
40
40
|
import"../shared/@ai-setting/roy-agent-core-46rv4d7d.js";
|
|
41
41
|
import {
|
|
42
42
|
WorkflowComponent
|
|
43
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
43
|
+
} from "../shared/@ai-setting/roy-agent-core-gr48c89p.js";
|
|
44
44
|
import"../shared/@ai-setting/roy-agent-core-es203w7p.js";
|
|
45
45
|
import"../shared/@ai-setting/roy-agent-core-h0x19xgn.js";
|
|
46
46
|
import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
|
|
47
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
48
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
49
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
47
|
+
import"../shared/@ai-setting/roy-agent-core-hfyfavp3.js";
|
|
48
|
+
import"../shared/@ai-setting/roy-agent-core-pakhchy7.js";
|
|
49
|
+
import"../shared/@ai-setting/roy-agent-core-sm0sf6sb.js";
|
|
50
50
|
import"../shared/@ai-setting/roy-agent-core-hhrg314p.js";
|
|
51
51
|
import"../shared/@ai-setting/roy-agent-core-12n08pg5.js";
|
|
52
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
52
|
+
import"../shared/@ai-setting/roy-agent-core-vah6g5yx.js";
|
|
53
53
|
import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
|
|
54
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
54
|
+
import"../shared/@ai-setting/roy-agent-core-attpry6g.js";
|
|
55
55
|
import"../shared/@ai-setting/roy-agent-core-efkjyh69.js";
|
|
56
56
|
import"../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
|
|
57
|
-
import"../shared/@ai-setting/roy-agent-core-ze068vc9.js";
|
|
58
57
|
import"../shared/@ai-setting/roy-agent-core-dvtg4sn0.js";
|
|
59
58
|
import"../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
60
59
|
import"../shared/@ai-setting/roy-agent-core-7exqwax1.js";
|
|
@@ -68,10 +67,10 @@ import"../shared/@ai-setting/roy-agent-core-jagkferh.js";
|
|
|
68
67
|
import {
|
|
69
68
|
AgentComponent,
|
|
70
69
|
AgentComponentConfigSchema
|
|
71
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
70
|
+
} from "../shared/@ai-setting/roy-agent-core-jgb3bb42.js";
|
|
72
71
|
import"../shared/@ai-setting/roy-agent-core-dt104qa1.js";
|
|
73
72
|
import"../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
74
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
73
|
+
import"../shared/@ai-setting/roy-agent-core-vm8h5zyj.js";
|
|
75
74
|
import {
|
|
76
75
|
XDG_PATHS,
|
|
77
76
|
getXDGPath,
|
package/dist/env/llm/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createLLMAdapter,
|
|
14
14
|
getLLMProviderOverride,
|
|
15
15
|
setLLMProvider
|
|
16
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
} from "../../shared/@ai-setting/roy-agent-core-rxb00gjm.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-adg9ghbt.js";
|
|
18
18
|
import {
|
|
19
19
|
PiAiAdapter,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temperature policy — 端点硬约束 + 优先级解析(Task #4946)
|
|
3
|
+
*
|
|
4
|
+
* ## 为什么需要这个模块
|
|
5
|
+
*
|
|
6
|
+
* 2026-11-04 用户在飞书报告:
|
|
7
|
+
* `roy-agent act hi --model kimi/k3.1-pro-highspeed`
|
|
8
|
+
* → `AI_APICallError: invalid temperature: only 1 is allowed for this model`
|
|
9
|
+
* (`https://api.kimi.com/coding/v1/chat/completions`, requestBody temperature: 0.7)
|
|
10
|
+
*
|
|
11
|
+
* 直打真实端点的实测结论(6 个模型全覆盖):
|
|
12
|
+
* - `temperature: 0.7` → HTTP 400 invalid temperature
|
|
13
|
+
* - `temperature: 1` → HTTP 200
|
|
14
|
+
* - 省略 `temperature` → HTTP 200
|
|
15
|
+
* ⇒ Kimi For Coding 端点**只接受 1 或不传**,与模型 id 无关,是端点级约束。
|
|
16
|
+
*
|
|
17
|
+
* ## 为什么不能只靠用户配置
|
|
18
|
+
*
|
|
19
|
+
* `ProviderConfig.temperature`(types.ts 的字段 + Zod schema)此前**没有任何
|
|
20
|
+
* 读取点** —— 用户在 `config.jsonc` 的 provider 块里写 `"temperature": 1` 完全
|
|
21
|
+
* 无效,而全局 `llm.temperature` 又会把同一份值广播给**所有** provider。
|
|
22
|
+
* 于是用户只能在「全局改成 1(污染所有模型)」和「报 400」之间二选一。
|
|
23
|
+
*
|
|
24
|
+
* 本模块做两件事:
|
|
25
|
+
* 1. `FIXED_TEMPERATURE_ENDPOINTS` —— 把「端点硬约束」变成**声明式数据**,
|
|
26
|
+
* 由 baseURL(首选证据)或已知 provider id 识别,避免按用户自定义
|
|
27
|
+
* provider 名字瞎猜(`kimi` 是用户起的名字,`kimi-coding` 才是 pi-ai 内置 id)。
|
|
28
|
+
* 2. `resolveTemperature()` —— 单一优先级解析函数:
|
|
29
|
+
* request > 显式全局 `llm.temperature` > provider 级 `temperature` > 内置 0.7
|
|
30
|
+
* 最后再套用端点硬约束。这样 provider 级配置从此是**活的**,
|
|
31
|
+
* 而硬约束端点无论上层传什么都不可能再发出非法值。
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
*/
|
|
35
|
+
/** 一条「端点硬约束 temperature」声明。 */
|
|
36
|
+
export interface FixedTemperatureEndpoint {
|
|
37
|
+
/** 说明性标识(日志 / 报错用)。 */
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* 命中用的 baseURL 片段(**首选证据**)。
|
|
41
|
+
*
|
|
42
|
+
* 刻意匹配到域名 + 路径前缀(如 `api.kimi.com/coding`),这样同一家
|
|
43
|
+
* 厂商「编码套餐」和「通用 API」两条线不会互相误伤。
|
|
44
|
+
*/
|
|
45
|
+
baseURLIncludes: string;
|
|
46
|
+
/**
|
|
47
|
+
* 已知的 pi-ai 内置 provider id(baseURL 缺失时的兜底证据)。
|
|
48
|
+
*
|
|
49
|
+
* 只在 baseURL 解析不出来时使用,且必须是厂商官方 id,不能是用户自定义
|
|
50
|
+
* 的 provider 别名(用户随时可能把 `kimi` 指向别家网关)。
|
|
51
|
+
*/
|
|
52
|
+
providerIds?: readonly string[];
|
|
53
|
+
/** 强制发送的 temperature 值。 */
|
|
54
|
+
temperature: number;
|
|
55
|
+
/** 为什么必须固定(写进文档/日志,避免日后被当成魔法数删掉)。 */
|
|
56
|
+
reason: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 端点硬约束表。
|
|
60
|
+
*
|
|
61
|
+
* 新增条目要求:
|
|
62
|
+
* - 有**真实请求**证据(curl 过 400 / 200 两组对照,不是看文档猜的);
|
|
63
|
+
* - `baseURLIncludes` 足够具体(域名 + 路径前缀),不要只写厂商名片段。
|
|
64
|
+
*/
|
|
65
|
+
export declare const FIXED_TEMPERATURE_ENDPOINTS: readonly FixedTemperatureEndpoint[];
|
|
66
|
+
/**
|
|
67
|
+
* 在硬约束表里查找匹配项。
|
|
68
|
+
*
|
|
69
|
+
* 匹配顺序:baseURL 优先(真实证据),providerIds 兜底(已知官方 id)。
|
|
70
|
+
* 两者都无命中时返回 `undefined`。
|
|
71
|
+
*/
|
|
72
|
+
export declare function findFixedTemperatureRule(input: {
|
|
73
|
+
providerId?: string;
|
|
74
|
+
baseURL?: string;
|
|
75
|
+
}): FixedTemperatureEndpoint | undefined;
|
|
76
|
+
/** 未做任何配置时沿用的历史默认值(保持向后兼容)。 */
|
|
77
|
+
export declare const DEFAULT_TEMPERATURE = 0.7;
|
|
78
|
+
export interface ResolveTemperatureInput {
|
|
79
|
+
/** 调用方显式指定的 temperature(最高优先级)。 */
|
|
80
|
+
requestTemperature?: number;
|
|
81
|
+
/**
|
|
82
|
+
* 显式配置的全局 `llm.temperature`。
|
|
83
|
+
*
|
|
84
|
+
* 注意:**必须是「用户真的配了」才有值**。不要把 `?? 0.7` 在这里做完 ——
|
|
85
|
+
* 否则 provider 级配置永远不会生效(这正是修复前的死锁)。
|
|
86
|
+
*/
|
|
87
|
+
globalTemperature?: number;
|
|
88
|
+
/** provider 块里的 `temperature`(修复前是 dead field)。 */
|
|
89
|
+
providerTemperature?: number;
|
|
90
|
+
/** 解析后的 provider baseURL(硬约束识别的主证据)。 */
|
|
91
|
+
baseURL?: string;
|
|
92
|
+
/** provider id(硬约束识别的兜底证据)。 */
|
|
93
|
+
providerId?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ResolveTemperatureResult {
|
|
96
|
+
/** 最终应当放进请求体的 temperature。 */
|
|
97
|
+
temperature: number;
|
|
98
|
+
/** 若命中了端点硬约束,这里是那条规则(调用方可用于日志)。 */
|
|
99
|
+
clampedBy?: FixedTemperatureEndpoint;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 解析最终 temperature。
|
|
103
|
+
*
|
|
104
|
+
* 优先级:request > 显式全局 > provider 级 > {@link DEFAULT_TEMPERATURE},
|
|
105
|
+
* 最后套用端点硬约束(命中则无条件覆盖,因为端点会直接 400)。
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveTemperature(input: ResolveTemperatureInput): ResolveTemperatureResult;
|
package/dist/env/llm/types.d.ts
CHANGED
|
@@ -627,13 +627,12 @@ export declare const LLMConfigSchema: z.ZodObject<{
|
|
|
627
627
|
providerOptions?: Record<string, unknown> | undefined;
|
|
628
628
|
}>>;
|
|
629
629
|
defaultProvider: z.ZodString;
|
|
630
|
-
temperature: z.
|
|
630
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
631
631
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
632
632
|
topP: z.ZodOptional<z.ZodNumber>;
|
|
633
633
|
stream: z.ZodDefault<z.ZodBoolean>;
|
|
634
634
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
635
635
|
}, "strip", z.ZodTypeAny, {
|
|
636
|
-
temperature: number;
|
|
637
636
|
providers: Record<string, {
|
|
638
637
|
provider: string;
|
|
639
638
|
apiKey: string;
|
|
@@ -668,6 +667,7 @@ export declare const LLMConfigSchema: z.ZodObject<{
|
|
|
668
667
|
stream: boolean;
|
|
669
668
|
options?: Record<string, unknown> | undefined;
|
|
670
669
|
defaultModel?: string | undefined;
|
|
670
|
+
temperature?: number | undefined;
|
|
671
671
|
maxTokens?: number | undefined;
|
|
672
672
|
default?: {
|
|
673
673
|
temperature?: number | undefined;
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-34jz9mgh.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-yhwxpj12.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-4jjwewvw.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
@@ -412,8 +412,8 @@ ${string}
|
|
|
412
412
|
* - persistSession=false:子 agent 的运行不写回父 session DB
|
|
413
413
|
*/
|
|
414
414
|
readonly "workflow-extract": "# Workflow Extract Agent\n\n你是 Workflow 提取专家。**唯一职责**:从 task 的对话历史中分析需求,生成可复用的 Workflow YAML,并通过工作流工具迭代式构建并验证。\n\n## 工具\n\n你有 4 个工具可用:\n\n| 工具 | 用途 |\n|------|------|\n| `workflow_list` | 浏览已有 workflow(学习节点结构、命名约定) |\n| `workflow_get` | 获取指定 workflow 详情(查看完整 YAML) |\n| `workflow_validate` | 验证 YAML 结构(依赖、节点 ID、循环检测) |\n| `workflow_add` | 添加新 workflow(需要 1-3 个 tags) |\n\n## 迭代式构建流程\n\n**重要**:必须按以下流程调用工具,**不能跳过 validate**。\n\n1. **学习** —— 调用 `workflow_list` 和 `workflow_get <name>` 查看已有 workflow\n2. **设计** —— 根据需求生成 YAML 草稿(内存中)\n3. **验证** —— 调用 `workflow_validate` 验证结构\n4. **修正** —— 验证失败 → 修正 YAML → 重新验证(直到通过)\n5. **添加** —— 验证通过后调用 `workflow_add` 提交\n\n## 构建原则\n\n1. **优先具象节点**:优先使用特定工具节点(如 tool/skill/agent)\n2. **避免条件分支**:不提取循环和条件判断,保持线性流程\n3. **至少 2 个节点**:单节点 workflow 无意义\n4. **必须设置 tags**:tags 是 workflow 分类的依据(1-3 个)\n5. **节点 ID 唯一**:每个节点必须有唯一 id\n\n## 验证失败的处理\n\n如果 `workflow_validate` 返回 invalid:\n\n1. 仔细阅读 errors 列表\n2. 修正 YAML(节点 ID 重复、依赖缺失、循环等问题)\n3. 重新调用 `workflow_validate` 验证\n4. 最多迭代 8 次,超过则停止并报告失败原因\n\n## YAML 结构参考\n\n```yaml\nname: <workflow-name> # 必填,kebab-case\nversion: \"1.0\" # 选填,默认 1.0\ndescription: <一句话描述>\ntags: [<至少1个,最多3个>] # 必填\nnodes:\n - id: node-1 # 必填,唯一\n type: tool|skill|agent # 必填\n name: <节点名称>\n config: {} # 根据类型配置\n depends_on: [] # 依赖列表\noutputs: [] # 输出定义(可空)\n```\n\n## 禁止\n\n- ❌ 不要跳过 `workflow_validate` 直接 `workflow_add`\n- ❌ 不要生成少于 2 个节点的 workflow\n- ❌ 不要生成条件节点(if/else/switch)或循环节点(while/for)\n- ❌ 不要使用 bash 或其他工具(严格使用 4 个 workflow 工具)";
|
|
415
|
-
readonly compact: "# Session Checkpoint Generator\n\n你是专业的会话 checkpoint
|
|
416
|
-
readonly "compact-hint": "# Compact Hint Generator\n\n
|
|
415
|
+
readonly compact: "# Session Checkpoint Generator\n\n你是专业的会话 checkpoint 生成器。阅读对话历史,输出一份**自然语言**的会话 checkpoint,\n供后续接手者(可能是新的 AI 会话)快速了解\"之前发生了什么、现在到哪一步了、接下来要做什么\"。\n\n## 输出要求\n\n**直接输出 checkpoint 正文**,用自己的话写,形式自由(连续段落、要点列表、混合都行)。\n内容上要覆盖这几件事(不要求任何段落标题,也不要求固定顺序):\n\n- 这次会话做了什么、进展到哪一步\n- 关键决策 / 关键发现 / 踩过的坑\n- 当前状态:手上有什么、卡在哪里\n- 后续要做什么\n- 用户的核心诉求\n\n## 硬性要求\n\n- **不要**输出 JSON、不要代码块围栏、不要\"以下是 checkpoint\"之类的开场白\n- **不要**使用固定的小节标题模板(如 Summary / Current State 之类),自然叙述即可\n- 直接用中文写(除非对话本身是英文)\n- 信息密度优先:写具体的东西(文件名、命令、报错原文、参数值),不要空泛概括\n- 篇幅控制在能让人快速读完的长度(约 200-800 字),拖沓冗余不如简洁\n- 用户输入里若带了场景提示(scenario hint),它指明了重点关注方向,请优先覆盖";
|
|
416
|
+
readonly "compact-hint": "# Compact Hint Generator\n\n你是会话压缩指导提示生成器。分析对话历史,产出一段\"压缩关注点提示\",告诉\ncheckpoint 生成器在压缩这次会话时**最该保留什么**。\n\n## 输出要求\n\n- **直接回复提示正文**(3-4 句话),不要 JSON、不要代码块、不要工具调用、不要任何额外说明或开场白\n- 内容要具体:指出本次会话的主题、当前进展、以及压缩时最该保留的信息\n- 用自然语言描述,可以是一段话或几条要点\n\n示例:\n\n会话围绕 lark-cli 多 profile 部署展开:已完成 profile 选型与凭据写入,当前卡在用户身份 reply 的权限确认。压缩时应重点保留各 profile 的 region 与凭据路径,以及权限报错原文。";
|
|
417
417
|
/**
|
|
418
418
|
* workflow-creator — 交互式 workflow 构建子智能体 (Task #2194)
|
|
419
419
|
*
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 真实 session 回放 + **压缩后 resume 验证** harness (Task #4933 C 方案)
|
|
3
|
+
*
|
|
4
|
+
* 用户点名的两条硬验收:
|
|
5
|
+
* 3.1 压缩后 session resume:「压缩后还可以继续基于压缩内容进行对话」
|
|
6
|
+
* 3.2 压缩效果与时长
|
|
7
|
+
*
|
|
8
|
+
* 本 harness 做的事:
|
|
9
|
+
* Phase A — 回放 & 压缩
|
|
10
|
+
* 1. 从生产 sessions.db(**只读**)读某个真实 session 的未归档消息
|
|
11
|
+
* 2. 灌进完全隔离的临时 sqlite db(临时目录,不碰生产库)
|
|
12
|
+
* 3. 用**真实** minimax/MiniMax-M3.1-Flash 跑两阶段压缩
|
|
13
|
+
* (compact-hint → hint 注入 → compact → 整段自然语言 checkpoint)
|
|
14
|
+
* 4. 测耗时 / 输入规模 / checkpoint 正文长度
|
|
15
|
+
*
|
|
16
|
+
* Phase B — resume 验证(核心)
|
|
17
|
+
* 5. 断言压缩后新的 LLM 上下文**只含 checkpoint 消息 + 之后的消息**
|
|
18
|
+
* (旧消息全部归档,不泄漏)
|
|
19
|
+
* 6. 从 checkpoint 正文里提取一个「事实探针」(只有在读 checkpoint 才可能知道
|
|
20
|
+
* 的具体细节:文件名 / 命令 / 报错 / 参数)
|
|
21
|
+
* 7. 用一个**全新 agent 会话**(干净的 conversation,只有 checkpoint 消息作为历史)
|
|
22
|
+
* 问一个只有读 checkpoint 才能答对的问题
|
|
23
|
+
* 8. 校验 assistant 回答是否命中了探针事实 → 证明 resume 真的基于压缩内容
|
|
24
|
+
*
|
|
25
|
+
* Phase C — 旧格式 checkpoint resume
|
|
26
|
+
* 9. 构造一个旧格式(五栏位)checkpoint → 读时适配 → resume 对话正常
|
|
27
|
+
*
|
|
28
|
+
* ⚠️ 纪律:
|
|
29
|
+
* - 生产库只用 readonly 打开,绝不写
|
|
30
|
+
* - 临时 db 在 os.tmpdir(),跑完自动删除
|
|
31
|
+
* - 真实调用 LLM(消耗额度)
|
|
32
|
+
*/
|
|
33
|
+
import type { ConfigComponent } from "../../../config/config-component";
|
|
34
|
+
interface RawMessage {
|
|
35
|
+
role: string;
|
|
36
|
+
content: string;
|
|
37
|
+
parts: string | null;
|
|
38
|
+
metadata: string | null;
|
|
39
|
+
is_archived: number;
|
|
40
|
+
timestamp: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function getProdDbPath(): string;
|
|
43
|
+
/**
|
|
44
|
+
* 从生产库读取某 session 的**未归档**消息(只读连接)。
|
|
45
|
+
*/
|
|
46
|
+
export declare function readSessionMessages(sessionId: string, limit?: number): {
|
|
47
|
+
messages: RawMessage[];
|
|
48
|
+
total: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 从 checkpoint 正文里抽「事实探针」—— 只有在读到 checkpoint 内容时才可能知道的
|
|
52
|
+
* 具体细节(路径 / 命令 / 报错码 / 版本号 / 长标识符)。
|
|
53
|
+
*
|
|
54
|
+
* 策略:抓形如以下的高辨识度 token:
|
|
55
|
+
* - 文件路径 `/a/b/c.ts`
|
|
56
|
+
* - 命令 `bun test` / `git commit`
|
|
57
|
+
* - 版本 `v1.2.3` / `1.7.71`
|
|
58
|
+
* - 长标识符 `session_xxx` / `Minimax-M3.1-Flash` / 反引号内容
|
|
59
|
+
* - 数字+单位 `4731 条` / `P50=118s`
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractFactProbes(content: string, max?: number): string[];
|
|
62
|
+
/**
|
|
63
|
+
* 判定回答是否命中了探针(关键词命中率)。
|
|
64
|
+
*
|
|
65
|
+
* 归一化:小写 + 去空白,避免中英文混排 / 空格差异造成假阴性。
|
|
66
|
+
*/
|
|
67
|
+
export declare function scoreAnswerHit(answer: string, probes: string[]): {
|
|
68
|
+
hits: string[];
|
|
69
|
+
hitRate: number;
|
|
70
|
+
};
|
|
71
|
+
export interface ResumeProbeResult {
|
|
72
|
+
/** 用于追问的问题 */
|
|
73
|
+
question: string;
|
|
74
|
+
/** 从 checkpoint 抽出的事实探针 */
|
|
75
|
+
probes: string[];
|
|
76
|
+
/** assistant 的回答 */
|
|
77
|
+
answer: string;
|
|
78
|
+
/** 命中的探针 */
|
|
79
|
+
hits: string[];
|
|
80
|
+
/** 命中率 */
|
|
81
|
+
hitRate: number;
|
|
82
|
+
/** 回答长度 */
|
|
83
|
+
answerLength: number;
|
|
84
|
+
/** 本次追问耗时 */
|
|
85
|
+
resumeMs: number;
|
|
86
|
+
/** resume 时 LLM 看到的历史消息数(应为 checkpoint + 之后的消息) */
|
|
87
|
+
contextMessageCount: number;
|
|
88
|
+
/** resume 时历史里是否含归档前的老消息(泄漏检测) */
|
|
89
|
+
leakedArchivedContent: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface ReplayResult {
|
|
92
|
+
sessionId: string;
|
|
93
|
+
totalMessagesInSession: number;
|
|
94
|
+
replayedMessages: number;
|
|
95
|
+
inputChars: number;
|
|
96
|
+
compactModel: string;
|
|
97
|
+
phase1Ms: number;
|
|
98
|
+
phase2Ms: number;
|
|
99
|
+
totalMs: number;
|
|
100
|
+
hint: string;
|
|
101
|
+
hintLength: number;
|
|
102
|
+
hintInjected: boolean;
|
|
103
|
+
hintOverlapTokens: number;
|
|
104
|
+
checkpoint: {
|
|
105
|
+
title: string;
|
|
106
|
+
contentLength: number;
|
|
107
|
+
contentPreview: string;
|
|
108
|
+
/** C 方案:正文是否含伪造的五小节标题(应为 false) */
|
|
109
|
+
hasForgedSectionHeaders: boolean;
|
|
110
|
+
};
|
|
111
|
+
checkpointMessagePreview: string;
|
|
112
|
+
/** ★ resume 验证结果 */
|
|
113
|
+
resume: ResumeProbeResult | null;
|
|
114
|
+
errors: string[];
|
|
115
|
+
}
|
|
116
|
+
export declare function replay(args: {
|
|
117
|
+
sessionId: string;
|
|
118
|
+
limit?: number;
|
|
119
|
+
bootstrapAgentComponent: (configComponent: ConfigComponent) => Promise<any>;
|
|
120
|
+
/** 跳过 resume 验证(只测压缩) */
|
|
121
|
+
skipResume?: boolean;
|
|
122
|
+
/** 自定义追问问题(默认自动生成) */
|
|
123
|
+
resumeQuestion?: string;
|
|
124
|
+
/**
|
|
125
|
+
* 旧格式 checkpoint 模式:不跑真实压缩,而是注入一个旧格式 checkpoint
|
|
126
|
+
* 来验证读时适配 + resume。
|
|
127
|
+
*/
|
|
128
|
+
legacyCheckpoint?: {
|
|
129
|
+
title: string;
|
|
130
|
+
processKeyPoints: string[];
|
|
131
|
+
currentState: string;
|
|
132
|
+
nextSteps: string[];
|
|
133
|
+
userIntents: string[];
|
|
134
|
+
summary?: string;
|
|
135
|
+
};
|
|
136
|
+
}): Promise<ReplayResult>;
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 回放测试 runner (Task #4933)
|
|
3
|
+
*
|
|
4
|
+
* 建一个**最小但真实**的 Environment(只含 config/llm/agent/prompt 组件),
|
|
5
|
+
* 然后对本仓库的真实 session 做回放压缩。
|
|
6
|
+
*
|
|
7
|
+
* 用法:
|
|
8
|
+
* cd <worktree>
|
|
9
|
+
* bun run packages/core/src/env/session/__bench__/run-replay.ts \
|
|
10
|
+
* --session <sessionId> [--limit N]
|
|
11
|
+
*
|
|
12
|
+
* 也可以一次跑多个:
|
|
13
|
+
* bun run .../run-replay.ts --sessions id1,id2,id3 --limit 800
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview C 方案 checkpoint 内容处理(Task #4933 重写)
|
|
3
|
+
*
|
|
4
|
+
* 用户决策(飞书群 oc_4afcc8f93c811e5371dd00674d16a6b1):
|
|
5
|
+
* 压缩最终产物是**整段自然语言** checkpoint 正文(`content`),
|
|
6
|
+
* 不再有 summary/processKeyPoints/currentState/nextSteps/userIntents 五栏位,
|
|
7
|
+
* 也不再有固定 markdown 小节契约 + 章节解析器(上一轮方案被用户否定)。
|
|
8
|
+
*
|
|
9
|
+
* 本模块是**纯函数**集合:
|
|
10
|
+
* 1. normalizeCheckpointContent — 守护:只判「有没有实质文本」
|
|
11
|
+
* 2. buildCheckpointFromText — LLM 自然语言输出 → { title, content }
|
|
12
|
+
* 3. adaptLegacyCheckpoint — 旧格式(五栏位)读时适配 → 新格式
|
|
13
|
+
* 4. createCheckpointContent — checkpoint 消息正文渲染
|
|
14
|
+
*
|
|
15
|
+
* 设计原则:
|
|
16
|
+
* - 守护逻辑极简但必须保留:全空 → 拒绝归档(2026-10-16 生产事故,
|
|
17
|
+
* 曾静默吞掉 4731 条消息,绝对不能回归)
|
|
18
|
+
* - 旧 checkpoint 的语义完整保留(读时适配,不写回数据库)
|
|
19
|
+
*/
|
|
20
|
+
import type { SessionCheckpoint } from "./types";
|
|
21
|
+
/**
|
|
22
|
+
* 判断一段文本是否可作为 checkpoint 正文。
|
|
23
|
+
*
|
|
24
|
+
* 守护规则(极简):
|
|
25
|
+
* - 非空(trim 后有内容)
|
|
26
|
+
* - 不是降级哨兵
|
|
27
|
+
* - 长度 ≥ MIN_CONTENT_LENGTH
|
|
28
|
+
*
|
|
29
|
+
* @returns 归一化(trim)后的正文,不可用返回 undefined
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeCheckpointContent(text?: string | null): string | undefined;
|
|
32
|
+
export interface CheckpointFromText {
|
|
33
|
+
title: string;
|
|
34
|
+
content: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 把 LLM 输出的整段自然语言构造成 checkpoint 的 title + content。
|
|
38
|
+
*
|
|
39
|
+
* 标题策略:首个 markdown 标题行(`#`~`######`)→ 否则首个非空行;
|
|
40
|
+
* 超长截断到 80 字符。正文整段保留(含列表、代码块等自由形式)。
|
|
41
|
+
*
|
|
42
|
+
* @returns { title, content },文本不可用返回 undefined
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildCheckpointFromText(text?: string | null): CheckpointFromText | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* 把旧格式 checkpoint(summary/processKeyPoints/currentState/nextSteps/
|
|
47
|
+
* userIntents 五栏位)在**内存中**适配为新格式(content 整段自然语言)。
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ 只做读时适配:不写回数据库、不修改原对象(纯函数)。
|
|
50
|
+
* 生产库 555 个存量 checkpoint 全是旧格式,靠本函数在读取时
|
|
51
|
+
* 合成 content,新代码无感知。
|
|
52
|
+
*
|
|
53
|
+
* 合成策略:title + summary + 各栏位编号串联,语义完整保留。
|
|
54
|
+
* 新格式原样返回(引用相等)。
|
|
55
|
+
*/
|
|
56
|
+
export declare function adaptLegacyCheckpoint(cp: SessionCheckpoint): SessionCheckpoint;
|
|
57
|
+
/**
|
|
58
|
+
* 渲染 checkpoint 消息正文(存为 user 消息,进入 LLM 上下文)。
|
|
59
|
+
*
|
|
60
|
+
* 形态(无伪造小节标题):
|
|
61
|
+
* # Checkpoint: {title}
|
|
62
|
+
*
|
|
63
|
+
* {整段 content}
|
|
64
|
+
*
|
|
65
|
+
* {N} messages compacted at {ISO}
|
|
66
|
+
*/
|
|
67
|
+
export declare function createCheckpointContent(checkpoint: SessionCheckpoint): string;
|
|
@@ -10,6 +10,7 @@ SessionCheckpointsMeta, // (new)
|
|
|
10
10
|
CreateSessionOptions, UpdateSessionOptions, ListSessionsOptions, AddMessageOptions, CompactOptions, // (new)
|
|
11
11
|
CompactResult, // (new)
|
|
12
12
|
CompactPreview, // (new)
|
|
13
|
+
CheckpointAdaptReport, // Task #4933
|
|
13
14
|
GetContextOptions, // (new)
|
|
14
15
|
GetContextResult, // (new)
|
|
15
16
|
GetMessagesOptions, } from "./types";
|
|
@@ -3,11 +3,10 @@ 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-pakhchy7.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-sm0sf6sb.js";
|
|
11
10
|
import"../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
12
11
|
import {
|
|
13
12
|
SessionMessageConverter
|