@downcity/agent 1.1.200 → 1.1.202

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 (228) hide show
  1. package/bin/agent/local/Agent.d.ts +3 -7
  2. package/bin/agent/local/Agent.d.ts.map +1 -1
  3. package/bin/agent/local/Agent.js +14 -19
  4. package/bin/agent/local/Agent.js.map +1 -1
  5. package/bin/agent/local/services/{AgentSessionManager.d.ts → AgentSessions.d.ts} +12 -17
  6. package/bin/agent/local/services/AgentSessions.d.ts.map +1 -0
  7. package/bin/agent/local/services/{AgentSessionManager.js → AgentSessions.js} +11 -26
  8. package/bin/agent/local/services/AgentSessions.js.map +1 -0
  9. package/bin/agent/remote/RemoteAgent.d.ts +2 -9
  10. package/bin/agent/remote/RemoteAgent.d.ts.map +1 -1
  11. package/bin/agent/remote/RemoteAgent.js +40 -22
  12. package/bin/agent/remote/RemoteAgent.js.map +1 -1
  13. package/bin/agent/remote/RemoteSession.d.ts +5 -5
  14. package/bin/agent/remote/RemoteSession.d.ts.map +1 -1
  15. package/bin/agent/remote/RemoteSession.js +5 -3
  16. package/bin/agent/remote/RemoteSession.js.map +1 -1
  17. package/bin/agent/remote/RemoteTransport.d.ts +2 -2
  18. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +2 -2
  19. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +5 -5
  20. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +2 -2
  21. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +2 -2
  22. package/bin/executor/Executor.d.ts +5 -5
  23. package/bin/executor/Executor.d.ts.map +1 -1
  24. package/bin/executor/Executor.js +22 -13
  25. package/bin/executor/Executor.js.map +1 -1
  26. package/bin/executor/SessionRunScope.d.ts +1 -1
  27. package/bin/executor/SessionRunScope.d.ts.map +1 -1
  28. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +3 -3
  29. package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +1 -1
  30. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +4 -5
  31. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
  32. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +56 -16
  33. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
  34. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts +27 -0
  35. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts.map +1 -0
  36. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js +181 -0
  37. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js.map +1 -0
  38. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.d.ts +45 -0
  39. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.d.ts.map +1 -0
  40. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.js +144 -0
  41. package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.js.map +1 -0
  42. package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +3 -3
  43. package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +1 -1
  44. package/bin/executor/composer/context/SessionContextComposer.d.ts +3 -3
  45. package/bin/executor/composer/context/SessionContextComposer.d.ts.map +1 -1
  46. package/bin/executor/composer/history/SessionHistoryComposer.d.ts +2 -2
  47. package/bin/executor/composer/history/SessionHistoryComposer.d.ts.map +1 -1
  48. package/bin/executor/composer/history/SessionHistoryWriter.d.ts +5 -5
  49. package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +1 -1
  50. package/bin/executor/composer/history/SessionHistoryWriter.js +6 -6
  51. package/bin/executor/composer/history/SessionHistoryWriter.js.map +1 -1
  52. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts +2 -2
  53. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +1 -1
  54. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js +5 -5
  55. package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +1 -1
  56. package/bin/executor/core-engine/CoreEngineMessageState.d.ts +5 -5
  57. package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -1
  58. package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -1
  59. package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
  60. package/bin/executor/core-engine/CoreEngineSignals.d.ts +4 -4
  61. package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +1 -1
  62. package/bin/executor/core-engine/CoreEngineSignals.js.map +1 -1
  63. package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +3 -3
  64. package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -1
  65. package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +1 -1
  66. package/bin/executor/messages/AssistantResultPersistence.d.ts +5 -5
  67. package/bin/executor/messages/AssistantResultPersistence.d.ts.map +1 -1
  68. package/bin/executor/messages/AssistantResultPersistence.js +1 -1
  69. package/bin/executor/messages/AssistantResultPersistence.js.map +1 -1
  70. package/bin/executor/messages/SessionAttachmentMapper.d.ts +3 -3
  71. package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +1 -1
  72. package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -1
  73. package/bin/executor/messages/SessionMessageCodec.d.ts +4 -4
  74. package/bin/executor/messages/SessionMessageCodec.d.ts.map +1 -1
  75. package/bin/executor/messages/SessionMessageCodec.js +5 -5
  76. package/bin/executor/messages/SessionMessageCodec.js.map +1 -1
  77. package/bin/executor/messages/SessionMessageLog.d.ts +3 -3
  78. package/bin/executor/messages/SessionMessageLog.d.ts.map +1 -1
  79. package/bin/executor/messages/SessionMessageLog.js.map +1 -1
  80. package/bin/executor/messages/SessionStepEventMapper.d.ts +2 -2
  81. package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -1
  82. package/bin/executor/messages/SessionStepEventMapper.js.map +1 -1
  83. package/bin/executor/messages/UserVisibleText.d.ts +3 -3
  84. package/bin/executor/messages/UserVisibleText.d.ts.map +1 -1
  85. package/bin/executor/messages/UserVisibleText.js +3 -3
  86. package/bin/executor/messages/UserVisibleText.js.map +1 -1
  87. package/bin/executor/services/ExecutorInflightService.d.ts +2 -2
  88. package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -1
  89. package/bin/executor/services/ExecutorInflightService.js +4 -4
  90. package/bin/executor/services/ExecutorInflightService.js.map +1 -1
  91. package/bin/executor/store/history/SessionHistoryStore.d.ts +24 -21
  92. package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -1
  93. package/bin/executor/store/history/SessionHistoryStore.js +3 -3
  94. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +18 -19
  95. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
  96. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +33 -36
  97. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
  98. package/bin/executor/tools/plugin/PluginToolDefinition.d.ts +1 -7
  99. package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -1
  100. package/bin/executor/tools/plugin/PluginToolSchemas.d.ts +4 -6
  101. package/bin/executor/tools/plugin/PluginToolSchemas.d.ts.map +1 -1
  102. package/bin/executor/tools/plugin/PluginToolSchemas.js +24 -10
  103. package/bin/executor/tools/plugin/PluginToolSchemas.js.map +1 -1
  104. package/bin/executor/types/{SessionMessages.d.ts → SessionRecords.d.ts} +53 -28
  105. package/bin/executor/types/SessionRecords.d.ts.map +1 -0
  106. package/bin/executor/types/SessionRecords.js +52 -0
  107. package/bin/executor/types/SessionRecords.js.map +1 -0
  108. package/bin/executor/types/SessionRun.d.ts +3 -3
  109. package/bin/executor/types/SessionRun.d.ts.map +1 -1
  110. package/bin/index.d.ts +1 -1
  111. package/bin/index.d.ts.map +1 -1
  112. package/bin/rpc/Client.d.ts +5 -5
  113. package/bin/rpc/Client.js +4 -4
  114. package/bin/session/Session.d.ts +6 -6
  115. package/bin/session/Session.d.ts.map +1 -1
  116. package/bin/session/Session.js +8 -8
  117. package/bin/session/Session.js.map +1 -1
  118. package/bin/session/SessionTitle.d.ts +2 -2
  119. package/bin/session/SessionTitle.d.ts.map +1 -1
  120. package/bin/session/SessionTitle.js +3 -3
  121. package/bin/session/SessionTitle.js.map +1 -1
  122. package/bin/session/browse/Browse.d.ts +12 -12
  123. package/bin/session/browse/Browse.d.ts.map +1 -1
  124. package/bin/session/browse/Browse.js +9 -9
  125. package/bin/session/browse/Browse.js.map +1 -1
  126. package/bin/session/index.d.ts +1 -1
  127. package/bin/session/index.js +1 -1
  128. package/bin/session/runtime/SessionPromptRuntime.d.ts +3 -3
  129. package/bin/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
  130. package/bin/session/services/SessionStateService.d.ts +7 -8
  131. package/bin/session/services/SessionStateService.d.ts.map +1 -1
  132. package/bin/session/services/SessionStateService.js +15 -31
  133. package/bin/session/services/SessionStateService.js.map +1 -1
  134. package/bin/session/services/SessionViewService.d.ts +4 -4
  135. package/bin/session/services/SessionViewService.js +12 -12
  136. package/bin/session/services/SessionViewService.js.map +1 -1
  137. package/bin/session/storage/Persistence.d.ts +4 -4
  138. package/bin/session/storage/Persistence.d.ts.map +1 -1
  139. package/bin/session/storage/RuntimeSessionPort.d.ts +2 -2
  140. package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
  141. package/bin/session/storage/RuntimeSessionPort.js +4 -4
  142. package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
  143. package/bin/types/agent/AgentTypes.d.ts +2 -2
  144. package/bin/types/agent/AgentTypes.d.ts.map +1 -1
  145. package/bin/types/agent/SessionActor.d.ts +11 -11
  146. package/bin/types/agent/SessionActor.d.ts.map +1 -1
  147. package/bin/types/agent/SessionTypes.d.ts +12 -12
  148. package/bin/types/agent/SessionTypes.d.ts.map +1 -1
  149. package/bin/types/executor/SessionRunContext.d.ts +2 -2
  150. package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
  151. package/bin/types/rpc/RpcProtocol.d.ts +6 -6
  152. package/bin/types/runtime/agent/AgentContext.d.ts +7 -7
  153. package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
  154. package/bin/types/sdk/AgentSessionAction.d.ts +8 -49
  155. package/bin/types/sdk/AgentSessionAction.d.ts.map +1 -1
  156. package/bin/types/sdk/AgentSessionAction.js +4 -4
  157. package/bin/types/sdk/AgentSessionTurn.d.ts +2 -2
  158. package/bin/types/sdk/AgentSessionTurn.d.ts.map +1 -1
  159. package/package.json +3 -3
  160. package/scripts/agent-ready.test.mjs +1 -1
  161. package/scripts/city-model-tool-loop.test.mjs +36 -4
  162. package/scripts/plugin-tool-bridge.test.mjs +13 -0
  163. package/scripts/session-action-message.test.mjs +25 -25
  164. package/scripts/session-compaction-prompts.test.mjs +97 -0
  165. package/scripts/session-history-archive.test.mjs +8 -8
  166. package/scripts/session-history-inflight.test.mjs +10 -10
  167. package/scripts/session-list-title.test.mjs +9 -9
  168. package/scripts/session-title-event.test.mjs +12 -10
  169. package/src/agent/local/Agent.ts +16 -22
  170. package/src/agent/local/services/{AgentSessionManager.ts → AgentSessions.ts} +16 -32
  171. package/src/agent/remote/RemoteAgent.ts +58 -23
  172. package/src/agent/remote/RemoteSession.ts +10 -8
  173. package/src/agent/remote/RemoteTransport.ts +5 -5
  174. package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +10 -10
  175. package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +6 -6
  176. package/src/executor/Executor.ts +30 -19
  177. package/src/executor/SessionRunScope.ts +1 -1
  178. package/src/executor/composer/compaction/SessionCompactionComposer.ts +3 -3
  179. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +73 -29
  180. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.ts +197 -0
  181. package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.ts +162 -0
  182. package/src/executor/composer/context/LocalSessionContextComposer.ts +5 -5
  183. package/src/executor/composer/context/SessionContextComposer.ts +5 -5
  184. package/src/executor/composer/history/SessionHistoryComposer.ts +2 -2
  185. package/src/executor/composer/history/SessionHistoryWriter.ts +10 -10
  186. package/src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts +13 -13
  187. package/src/executor/core-engine/CoreEngineMessageState.ts +8 -8
  188. package/src/executor/core-engine/CoreEngineRunner.ts +7 -7
  189. package/src/executor/core-engine/CoreEngineSignals.ts +7 -7
  190. package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +5 -5
  191. package/src/executor/messages/AssistantResultPersistence.ts +8 -8
  192. package/src/executor/messages/SessionAttachmentMapper.ts +11 -11
  193. package/src/executor/messages/SessionMessageCodec.ts +10 -10
  194. package/src/executor/messages/SessionMessageLog.ts +3 -3
  195. package/src/executor/messages/SessionStepEventMapper.ts +5 -5
  196. package/src/executor/messages/UserVisibleText.ts +9 -9
  197. package/src/executor/services/ExecutorInflightService.ts +7 -7
  198. package/src/executor/store/history/SessionHistoryStore.ts +26 -23
  199. package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +58 -62
  200. package/src/executor/tools/plugin/PluginToolSchemas.ts +24 -10
  201. package/src/executor/types/{SessionMessages.ts → SessionRecords.ts} +71 -40
  202. package/src/executor/types/SessionRun.ts +5 -5
  203. package/src/index.ts +4 -4
  204. package/src/rpc/Client.ts +9 -9
  205. package/src/session/Session.ts +10 -10
  206. package/src/session/SessionTitle.ts +7 -7
  207. package/src/session/browse/Browse.ts +38 -38
  208. package/src/session/index.ts +1 -1
  209. package/src/session/runtime/SessionPromptRuntime.ts +6 -6
  210. package/src/session/services/SessionStateService.ts +29 -44
  211. package/src/session/services/SessionTurnService.ts +4 -4
  212. package/src/session/services/SessionViewService.ts +21 -21
  213. package/src/session/storage/Persistence.ts +6 -6
  214. package/src/session/storage/RuntimeSessionPort.ts +6 -6
  215. package/src/types/agent/AgentTypes.ts +4 -4
  216. package/src/types/agent/SessionActor.ts +12 -12
  217. package/src/types/agent/SessionTypes.ts +12 -12
  218. package/src/types/executor/SessionRunContext.ts +2 -2
  219. package/src/types/rpc/RpcProtocol.ts +6 -6
  220. package/src/types/runtime/agent/AgentContext.ts +8 -8
  221. package/src/types/sdk/AgentSessionAction.ts +12 -56
  222. package/src/types/sdk/AgentSessionTurn.ts +2 -2
  223. package/tsconfig.tsbuildinfo +1 -1
  224. package/bin/agent/local/services/AgentSessionManager.d.ts.map +0 -1
  225. package/bin/agent/local/services/AgentSessionManager.js.map +0 -1
  226. package/bin/executor/types/SessionMessages.d.ts.map +0 -1
  227. package/bin/executor/types/SessionMessages.js +0 -46
  228. package/bin/executor/types/SessionMessages.js.map +0 -1
@@ -0,0 +1,181 @@
1
+ /**
2
+ * JsonlSessionCompactionFileOperations:上下文压缩文件操作记录模块。
3
+ *
4
+ * 关键点(中文)
5
+ * - 从被压缩的 session 消息中 best-effort 提取文件读写痕迹。
6
+ * - 输出结构化 XML 片段,追加到 LLM 生成的 compact summary 末尾。
7
+ * - 解析失败或没有文件操作时不影响 compact 主流程。
8
+ */
9
+ import { isTextUIPart } from "ai";
10
+ const PATH_CANDIDATE_RE = /(?:\.{1,2}\/|\/|[A-Za-z0-9_.@-]+\/)[A-Za-z0-9_.@~:+/=-]+/g;
11
+ const PATCH_FILE_RE = /^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm;
12
+ const GIT_STATUS_FILE_RE = /^\s*(?:[MADRCU?!]{1,2}|[ MADRCU?!][ MADRCU?!])\s+(.+)$/gm;
13
+ const READ_COMMAND_RE = /\b(?:cat|less|more|sed|nl|head|tail|rg|grep|find|ls|wc|stat|open|git\s+(?:show|diff|status|grep|ls-files))\b/;
14
+ /**
15
+ * 把压缩范围内的文件操作格式化为 XML。
16
+ */
17
+ export function format_session_compaction_file_operations(messages) {
18
+ const operations = collect_session_compaction_file_operations(messages);
19
+ if (operations.read_files.length === 0 && operations.modified_files.length === 0) {
20
+ return "";
21
+ }
22
+ return [
23
+ "<read-files>",
24
+ ...operations.read_files.map((file_path) => xml_escape(file_path)),
25
+ "</read-files>",
26
+ "",
27
+ "<modified-files>",
28
+ ...operations.modified_files.map((file_path) => xml_escape(file_path)),
29
+ "</modified-files>",
30
+ ].join("\n");
31
+ }
32
+ /**
33
+ * 收集压缩范围内的文件操作。
34
+ */
35
+ export function collect_session_compaction_file_operations(messages) {
36
+ const read_files = new Set();
37
+ const modified_files = new Set();
38
+ for (const message of Array.isArray(messages) ? messages : []) {
39
+ const text_blocks = extract_message_operation_texts(message);
40
+ for (const text of text_blocks) {
41
+ for (const file_path of extract_modified_files(text)) {
42
+ modified_files.add(file_path);
43
+ }
44
+ for (const file_path of extract_read_files(text)) {
45
+ read_files.add(file_path);
46
+ }
47
+ }
48
+ }
49
+ for (const file_path of modified_files) {
50
+ read_files.delete(file_path);
51
+ }
52
+ return {
53
+ read_files: [...read_files].sort(),
54
+ modified_files: [...modified_files].sort(),
55
+ };
56
+ }
57
+ /**
58
+ * 提取单条消息中可能包含文件操作的文本块。
59
+ */
60
+ function extract_message_operation_texts(message) {
61
+ const out = [];
62
+ const parts = Array.isArray(message.parts) ? message.parts : [];
63
+ for (const part of parts) {
64
+ if (isTextUIPart(part)) {
65
+ const text = String(part.text ?? "").trim();
66
+ if (text)
67
+ out.push(text);
68
+ continue;
69
+ }
70
+ const part_record = to_record(part);
71
+ if (!part_record)
72
+ continue;
73
+ const input_text = stringify_compact(part_record.input);
74
+ const output_text = stringify_compact(part_record.output);
75
+ const error_text = stringify_compact(part_record.errorText);
76
+ if (input_text)
77
+ out.push(input_text);
78
+ if (output_text)
79
+ out.push(output_text);
80
+ if (error_text)
81
+ out.push(error_text);
82
+ }
83
+ return out;
84
+ }
85
+ /**
86
+ * 提取 patch / git status 中的修改文件。
87
+ */
88
+ function extract_modified_files(text) {
89
+ const out = new Set();
90
+ for (const file_path of match_group_values(text, PATCH_FILE_RE)) {
91
+ const normalized = normalize_file_path(file_path);
92
+ if (normalized)
93
+ out.add(normalized);
94
+ }
95
+ for (const file_path of match_group_values(text, GIT_STATUS_FILE_RE)) {
96
+ const normalized = normalize_file_path(file_path);
97
+ if (normalized)
98
+ out.add(normalized);
99
+ }
100
+ return [...out];
101
+ }
102
+ /**
103
+ * 从读命令文本中提取读取路径。
104
+ */
105
+ function extract_read_files(text) {
106
+ const out = new Set();
107
+ const lines = String(text || "").split(/\r?\n/);
108
+ for (const line of lines) {
109
+ if (!READ_COMMAND_RE.test(line))
110
+ continue;
111
+ for (const candidate of line.match(PATH_CANDIDATE_RE) || []) {
112
+ const normalized = normalize_file_path(candidate);
113
+ if (normalized)
114
+ out.add(normalized);
115
+ }
116
+ }
117
+ return [...out];
118
+ }
119
+ /**
120
+ * 获取正则第一个捕获组的所有结果。
121
+ */
122
+ function match_group_values(text, pattern) {
123
+ const out = [];
124
+ pattern.lastIndex = 0;
125
+ let match = pattern.exec(text);
126
+ while (match) {
127
+ const value = String(match[1] || "").trim();
128
+ if (value)
129
+ out.push(value);
130
+ match = pattern.exec(text);
131
+ }
132
+ return out;
133
+ }
134
+ /**
135
+ * 归一化候选路径。
136
+ */
137
+ function normalize_file_path(value) {
138
+ let file_path = String(value || "").trim();
139
+ if (!file_path || file_path.includes("://"))
140
+ return "";
141
+ file_path = file_path.replace(/^["'`]+|["'`]+$/g, "");
142
+ file_path = file_path.replace(/[),.;:]+$/g, "");
143
+ if (!file_path || file_path === "." || file_path === "..")
144
+ return "";
145
+ if (file_path.startsWith("-"))
146
+ return "";
147
+ return file_path;
148
+ }
149
+ /**
150
+ * 转成对象记录。
151
+ */
152
+ function to_record(value) {
153
+ if (!value || typeof value !== "object" || Array.isArray(value))
154
+ return null;
155
+ return value;
156
+ }
157
+ /**
158
+ * 将未知结构紧凑地转为文本。
159
+ */
160
+ function stringify_compact(value) {
161
+ if (value === undefined || value === null)
162
+ return "";
163
+ if (typeof value === "string")
164
+ return value;
165
+ try {
166
+ return JSON.stringify(value);
167
+ }
168
+ catch {
169
+ return String(value);
170
+ }
171
+ }
172
+ /**
173
+ * XML 文本转义。
174
+ */
175
+ function xml_escape(value) {
176
+ return String(value || "")
177
+ .replace(/&/g, "&amp;")
178
+ .replace(/</g, "&lt;")
179
+ .replace(/>/g, "&gt;");
180
+ }
181
+ //# sourceMappingURL=JsonlSessionCompactionFileOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonlSessionCompactionFileOperations.js","sourceRoot":"","sources":["../../../../../src/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAelC,MAAM,iBAAiB,GACrB,2DAA2D,CAAC;AAC9D,MAAM,aAAa,GAAG,6CAA6C,CAAC;AACpE,MAAM,kBAAkB,GAAG,0DAA0D,CAAC;AACtF,MAAM,eAAe,GACnB,8GAA8G,CAAC;AAEjH;;GAEG;AACH,MAAM,UAAU,yCAAyC,CACvD,QAAkC;IAElC,MAAM,UAAU,GAAG,0CAA0C,CAAC,QAAQ,CAAC,CAAC;IACxE,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjF,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,cAAc;QACd,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAClE,eAAe;QACf,EAAE;QACF,kBAAkB;QAClB,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACtE,mBAAmB;KACpB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OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * JsonlSessionCompactionPrompts:上下文压缩提示词模块。
3
+ *
4
+ * 关键点(中文)
5
+ * - 统一维护 session compact 使用的 system prompt 与 user prompt。
6
+ * - 支持初始压缩、迭代更新压缩、turn prefix 压缩三类场景。
7
+ * - prompt 文本保持结构化格式稳定,便于后续 LLM 继续接力。
8
+ */
9
+ /**
10
+ * 上下文压缩 system prompt。
11
+ */
12
+ export declare const SESSION_COMPACTION_SYSTEM_PROMPT: string;
13
+ /**
14
+ * 构建初始上下文压缩 prompt。
15
+ */
16
+ export declare function build_initial_session_compaction_prompt(params: {
17
+ /** 待压缩的历史对话文本。 */
18
+ conversation_text: string;
19
+ }): string;
20
+ /**
21
+ * 构建迭代更新上下文压缩 prompt。
22
+ */
23
+ export declare function build_update_session_compaction_prompt(params: {
24
+ /** 已存在的旧摘要。 */
25
+ previous_summary: string;
26
+ /** 本次需要合入旧摘要的新对话文本。 */
27
+ new_conversation_text: string;
28
+ }): string;
29
+ /**
30
+ * 构建 turn prefix 压缩 prompt。
31
+ */
32
+ export declare function build_turn_prefix_session_compaction_prompt(params: {
33
+ /** 被切下来的 turn prefix 文本。 */
34
+ prefix_text: string;
35
+ }): string;
36
+ /**
37
+ * 给摘要追加文件操作 XML。
38
+ */
39
+ export declare function append_session_compaction_file_operations(params: {
40
+ /** LLM 生成的结构化摘要。 */
41
+ summary: string;
42
+ /** 文件操作 XML,空字符串时不追加。 */
43
+ file_operations_xml?: string;
44
+ }): string;
45
+ //# sourceMappingURL=JsonlSessionCompactionPrompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonlSessionCompactionPrompts.d.ts","sourceRoot":"","sources":["../../../../../src/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAIjC,CAAC;AAEb;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,MAAM,EAAE;IAC9D,kBAAkB;IAClB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAqCT;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,MAAM,EAAE;IAC7D,eAAe;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB;IACvB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CA+CT;AAED;;GAEG;AACH,wBAAgB,2CAA2C,CAAC,MAAM,EAAE;IAClE,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAmBT;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CAAC,MAAM,EAAE;IAChE,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,GAAG,MAAM,CAMT"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * JsonlSessionCompactionPrompts:上下文压缩提示词模块。
3
+ *
4
+ * 关键点(中文)
5
+ * - 统一维护 session compact 使用的 system prompt 与 user prompt。
6
+ * - 支持初始压缩、迭代更新压缩、turn prefix 压缩三类场景。
7
+ * - prompt 文本保持结构化格式稳定,便于后续 LLM 继续接力。
8
+ */
9
+ /**
10
+ * 上下文压缩 system prompt。
11
+ */
12
+ export const SESSION_COMPACTION_SYSTEM_PROMPT = [
13
+ "You are a context summarization assistant. Your task is to read a conversation between a user and an AI assistant, then produce a structured summary following the exact format specified.",
14
+ "",
15
+ "Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.",
16
+ ].join("\n");
17
+ /**
18
+ * 构建初始上下文压缩 prompt。
19
+ */
20
+ export function build_initial_session_compaction_prompt(params) {
21
+ return [
22
+ String(params.conversation_text || "").trim(),
23
+ "",
24
+ "The messages above are a conversation to summarize. Create a structured context checkpoint summary that another LLM will use to continue the work.",
25
+ "",
26
+ "Use this EXACT format:",
27
+ "",
28
+ "## Goal",
29
+ "[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]",
30
+ "",
31
+ "## Constraints & Preferences",
32
+ "- [Any constraints, preferences, or requirements mentioned by user]",
33
+ '- [Or "(none)" if none were mentioned]',
34
+ "",
35
+ "## Progress",
36
+ "### Done",
37
+ "- [x] [Completed tasks/changes]",
38
+ "",
39
+ "### In Progress",
40
+ "- [ ] [Current work]",
41
+ "",
42
+ "### Blocked",
43
+ "[Issues preventing progress, if any]",
44
+ "",
45
+ "## Key Decisions",
46
+ "- **[Decision]**: [Brief rationale]",
47
+ "",
48
+ "## Next Steps",
49
+ "1. [Ordered list of what should happen next]",
50
+ "",
51
+ "## Critical Context",
52
+ "- [Any data, examples, or references needed to continue]",
53
+ '- [Or "(none)" if not applicable]',
54
+ "",
55
+ "Keep each section concise. Preserve exact file paths, function names, and error messages.",
56
+ ].join("\n");
57
+ }
58
+ /**
59
+ * 构建迭代更新上下文压缩 prompt。
60
+ */
61
+ export function build_update_session_compaction_prompt(params) {
62
+ return [
63
+ "<previous-summary>",
64
+ String(params.previous_summary || "").trim(),
65
+ "</previous-summary>",
66
+ "",
67
+ String(params.new_conversation_text || "").trim(),
68
+ "",
69
+ "The messages above are NEW conversation messages to incorporate into the existing summary provided in <previous-summary> tags.",
70
+ "",
71
+ "Update the existing structured summary with new information. RULES:",
72
+ "- PRESERVE all existing information from the previous summary",
73
+ "- ADD new progress, decisions, and context from the new messages",
74
+ '- UPDATE the Progress section: move items from "In Progress" to "Done" when completed',
75
+ '- UPDATE "Next Steps" based on what was accomplished',
76
+ "- PRESERVE exact file paths, function names, and error messages",
77
+ "- If something is no longer relevant, you may remove it",
78
+ "",
79
+ "Use this EXACT format:",
80
+ "",
81
+ "## Goal",
82
+ "[Preserve existing goals, add new ones if the task expanded]",
83
+ "",
84
+ "## Constraints & Preferences",
85
+ "- [Preserve existing, add new ones discovered]",
86
+ "",
87
+ "## Progress",
88
+ "### Done",
89
+ "- [x] [Include previously done items AND newly completed items]",
90
+ "",
91
+ "### In Progress",
92
+ "- [ ] [Current work - update based on progress]",
93
+ "",
94
+ "### Blocked",
95
+ "[Current blockers - remove if resolved]",
96
+ "",
97
+ "## Key Decisions",
98
+ "- **[Decision]**: [Brief rationale] (preserve all previous, add new)",
99
+ "",
100
+ "## Next Steps",
101
+ "1. [Update based on current state]",
102
+ "",
103
+ "## Critical Context",
104
+ "- [Preserve important context, add new if needed]",
105
+ "",
106
+ "Keep each section concise. Preserve exact file paths, function names, and error messages.",
107
+ ].join("\n");
108
+ }
109
+ /**
110
+ * 构建 turn prefix 压缩 prompt。
111
+ */
112
+ export function build_turn_prefix_session_compaction_prompt(params) {
113
+ return [
114
+ String(params.prefix_text || "").trim(),
115
+ "",
116
+ "This is the PREFIX of a turn that was too large to keep. The SUFFIX (recent work) is retained.",
117
+ "",
118
+ "Summarize the prefix to provide context for the retained suffix:",
119
+ "",
120
+ "## Original Request",
121
+ "[What did the user ask for in this turn?]",
122
+ "",
123
+ "## Early Progress",
124
+ "- [Key decisions and work done in the prefix]",
125
+ "",
126
+ "## Context for Suffix",
127
+ "- [Information needed to understand the retained recent work]",
128
+ "",
129
+ "Be concise. Focus on what's needed to understand the kept suffix.",
130
+ ].join("\n");
131
+ }
132
+ /**
133
+ * 给摘要追加文件操作 XML。
134
+ */
135
+ export function append_session_compaction_file_operations(params) {
136
+ const summary = String(params.summary || "").trim();
137
+ const file_operations_xml = String(params.file_operations_xml || "").trim();
138
+ if (!file_operations_xml)
139
+ return summary;
140
+ if (!summary)
141
+ return file_operations_xml;
142
+ return `${summary}\n\n${file_operations_xml}`;
143
+ }
144
+ //# sourceMappingURL=JsonlSessionCompactionPrompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonlSessionCompactionPrompts.js","sourceRoot":"","sources":["../../../../../src/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,4LAA4L;IAC5L,EAAE;IACF,4HAA4H;CAC7H,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;GAEG;AACH,MAAM,UAAU,uCAAuC,CAAC,MAGvD;IACC,OAAO;QACL,MAAM,CAAC,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC7C,EAAE;QACF,oJAAoJ;QACpJ,EAAE;QACF,wBAAwB;QACxB,EAAE;QACF,SAAS;QACT,uGAAuG;QACvG,EAAE;QACF,8BAA8B;QAC9B,qEAAqE;QACrE,wCAAwC;QACxC,EAAE;QACF,aAAa;QACb,UAAU;QACV,iCAAiC;QACjC,EAAE;QACF,iBAAiB;QACjB,sBAAsB;QACtB,EAAE;QACF,aAAa;QACb,sCAAsC;QACtC,EAAE;QACF,kBAAkB;QAClB,qCAAqC;QACrC,EAAE;QACF,eAAe;QACf,8CAA8C;QAC9C,EAAE;QACF,qBAAqB;QACrB,0DAA0D;QAC1D,mCAAmC;QACnC,EAAE;QACF,2FAA2F;KAC5F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sCAAsC,CAAC,MAKtD;IACC,OAAO;QACL,oBAAoB;QACpB,MAAM,CAAC,MAAM,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC5C,qBAAqB;QACrB,EAAE;QACF,MAAM,CAAC,MAAM,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACjD,EAAE;QACF,gIAAgI;QAChI,EAAE;QACF,qEAAqE;QACrE,+DAA+D;QAC/D,kEAAkE;QAClE,uFAAuF;QACvF,sDAAsD;QACtD,iEAAiE;QACjE,yDAAyD;QAC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@@
7
7
  */
8
8
  import type { ModelMessage } from "ai";
9
9
  import type { SessionContextComposer, SessionContextComposeResult } from "../../composer/context/SessionContextComposer.js";
10
- import type { SessionMessageV1, SessionModelMessageV1 } from "../../../executor/types/SessionMessages.js";
10
+ import type { SessionRecordV1, SessionMessageRecordV1 } from "../../../executor/types/SessionRecords.js";
11
11
  import type { SessionSystemMessage } from "../../../executor/types/SessionPrompts.js";
12
12
  import type { Tool } from "ai";
13
13
  import type { SessionRunContext } from "../../../types/executor/SessionRunContext.js";
@@ -32,7 +32,7 @@ export declare class LocalSessionContextComposer implements SessionContextCompos
32
32
  compose(run_context: SessionRunContext): Promise<SessionContextComposeResult>;
33
33
  createPrepareStepHandler(input: {
34
34
  system: SessionSystemMessage[];
35
- appendMergedUserMessages: (messages: SessionMessageV1[]) => Promise<ModelMessage[]>;
35
+ appendMergedUserMessages: (messages: SessionRecordV1[]) => Promise<ModelMessage[]>;
36
36
  runContext: SessionRunContext;
37
37
  }): (input: {
38
38
  messages?: ModelMessage[];
@@ -44,7 +44,7 @@ export declare class LocalSessionContextComposer implements SessionContextCompos
44
44
  /**
45
45
  * 构造 fallback assistant 消息。
46
46
  */
47
- buildFallbackAssistantMessage(text: string, run_context: SessionRunContext): SessionModelMessageV1;
47
+ buildFallbackAssistantMessage(text: string, run_context: SessionRunContext): SessionMessageRecordV1;
48
48
  }
49
49
  export {};
50
50
  //# sourceMappingURL=LocalSessionContextComposer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalSessionContextComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/context/LocalSessionContextComposer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,qCAAqC,CA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"version":3,"file":"LocalSessionContextComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/context/LocalSessionContextComposer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,KAAK,kCAAkC,GAAG;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACxE,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiD;gBAE9D,OAAO,EAAE,kCAAkC;IAKjD,OAAO,CACX,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,2BAA2B,CAAC;IAevC,wBAAwB,CACtB,KAAK,EAAE;QACL,MAAM,EAAE,oBAAoB,EAAE,CAAC;QAC/B,wBAAwB,EAAE,CACxB,QAAQ,EAAE,eAAe,EAAE,KACxB,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7B,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GACA,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC;QACnD,MAAM,EAAE,oBAAoB,EAAE,CAAC;QAC/B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;KAC3B,CAAC;IAgDF,yBAAyB,CACvB,WAAW,EAAE,iBAAiB,GAC7B,CAAC,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;IAqBzC;;OAEG;IACH,6BAA6B,CAC3B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,GAC7B,sBAAsB;CAsB1B"}
@@ -6,7 +6,7 @@
6
6
  * - 不负责历史读写,不负责 system 解析,不负责 compact。
7
7
  */
8
8
  import type { ModelMessage, Tool } from "ai";
9
- import type { SessionMessageV1, SessionModelMessageV1 } from "../../../executor/types/SessionMessages.js";
9
+ import type { SessionRecordV1, SessionMessageRecordV1 } from "../../../executor/types/SessionRecords.js";
10
10
  import type { SessionSystemMessage } from "../../../executor/types/SessionPrompts.js";
11
11
  import type { SessionRunContext } from "../../../types/executor/SessionRunContext.js";
12
12
  /**
@@ -41,7 +41,7 @@ export interface SessionContextComposer {
41
41
  /**
42
42
  * 将新增 user 消息转换为可追加的模型消息。
43
43
  */
44
- appendMergedUserMessages: (messages: SessionMessageV1[]) => Promise<ModelMessage[]>;
44
+ appendMergedUserMessages: (messages: SessionRecordV1[]) => Promise<ModelMessage[]>;
45
45
  /**
46
46
  * 当前显式运行上下文。
47
47
  */
@@ -62,6 +62,6 @@ export interface SessionContextComposer {
62
62
  * 关键点(中文)
63
63
  * - fallback 消息构造由 ContextComposer 内部实现,Executor 不直接依赖 history Composer。
64
64
  */
65
- buildFallbackAssistantMessage(text: string, run_context: SessionRunContext): SessionModelMessageV1;
65
+ buildFallbackAssistantMessage(text: string, run_context: SessionRunContext): SessionMessageRecordV1;
66
66
  }
67
67
  //# sourceMappingURL=SessionContextComposer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionContextComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/context/SessionContextComposer.ts"],"names":[],"mappings":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,EAAE,iBAAiB,GAC7B,qBAAqB,CAAC;CAC1B"}
1
+ {"version":3,"file":"SessionContextComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/context/SessionContextComposer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAE9E;;OAEG;IACH,wBAAwB,CACtB,KAAK,EAAE;QACL;;WAEG;QACH,MAAM,EAAE,oBAAoB,EAAE,CAAC;QAC/B;;WAEG;QACH,wBAAwB,EAAE,CACxB,QAAQ,EAAE,eAAe,EAAE,KACxB,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7B;;WAEG;QACH,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GACA,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC;QACnD,MAAM,EAAE,oBAAoB,EAAE,CAAC;QAC/B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;KAC3B,CAAC,CAAC;IAEH;;OAEG;IACH,yBAAyB,CACvB,WAAW,EAAE,iBAAiB,GAC7B,CAAC,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;;;OAKG;IACH,6BAA6B,CAC3B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,GAC7B,sBAAsB,CAAC;CAC3B"}
@@ -7,7 +7,7 @@
7
7
  * - 不负责模型调用,不负责执行编排。
8
8
  */
9
9
  import type { LanguageModel, Tool } from "ai";
10
- import type { SessionMessageV1 } from "../../../executor/types/SessionMessages.js";
10
+ import type { SessionRecordV1 } from "../../../executor/types/SessionRecords.js";
11
11
  import type { SessionSystemMessage } from "../../../executor/types/SessionPrompts.js";
12
12
  /**
13
13
  * prepare 输入参数。
@@ -49,6 +49,6 @@ export interface SessionHistoryComposer {
49
49
  /**
50
50
  * 为本轮 Session 执行准备模型输入消息。
51
51
  */
52
- prepare(input: SessionHistoryPrepareInput): Promise<SessionMessageV1[]>;
52
+ prepare(input: SessionHistoryPrepareInput): Promise<SessionRecordV1[]>;
53
53
  }
54
54
  //# sourceMappingURL=SessionHistoryComposer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionHistoryComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryComposer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE5B;;OAEG;IACH,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CACzE"}
1
+ {"version":3,"file":"SessionHistoryComposer.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryComposer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE5B;;OAEG;IACH,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACxE"}
@@ -7,7 +7,7 @@
7
7
  * - 会话更新后的通知也收在这里,避免把写入细节散到 Session 主类里。
8
8
  */
9
9
  import type { JsonObject } from "../../../types/common/Json.js";
10
- import type { SessionMessageV1 } from "../../../executor/types/SessionMessages.js";
10
+ import type { SessionRecordV1 } from "../../../executor/types/SessionRecords.js";
11
11
  import type { SessionHistoryStore } from "../../../executor/store/history/SessionHistoryStore.js";
12
12
  type SessionHistoryWriterOptions = {
13
13
  /**
@@ -38,16 +38,16 @@ export declare class SessionHistoryWriter {
38
38
  /**
39
39
  * 追加一条 user 消息。
40
40
  */
41
- appendUserMessage(params: {
42
- message?: SessionMessageV1 | null;
41
+ append_user_message(params: {
42
+ message?: SessionRecordV1 | null;
43
43
  text?: string;
44
44
  extra?: JsonObject;
45
45
  }): Promise<void>;
46
46
  /**
47
47
  * 追加一条 assistant 消息。
48
48
  */
49
- appendAssistantMessage(params: {
50
- message?: SessionMessageV1 | null;
49
+ append_assistant_message(params: {
50
+ message?: SessionRecordV1 | null;
51
51
  fallbackText?: string;
52
52
  extra?: JsonObject;
53
53
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"SessionHistoryWriter.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryWriter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,KAAK,2BAA2B,GAAG;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,eAAe,EAAE,MAAM,mBAAmB,CAAC;IAE3C;;OAEG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiD;IACjF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAwD;gBAEpF,OAAO,EAAE,2BAA2B;IAShD;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/C;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE;QAC9B,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjB;;OAEG;IACG,sBAAsB,CAAC,MAAM,EAAE;QACnC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAClC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BlB"}
1
+ {"version":3,"file":"SessionHistoryWriter.d.ts","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryWriter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,KAAK,2BAA2B,GAAG;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,eAAe,EAAE,MAAM,mBAAmB,CAAC;IAE3C;;OAEG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiD;IACjF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAwD;gBAEpF,OAAO,EAAE,2BAA2B;IAShD;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/C;;OAEG;IACG,mBAAmB,CAAC,MAAM,EAAE;QAChC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjB;;OAEG;IACG,wBAAwB,CAAC,MAAM,EAAE;QACrC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;QACjC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BlB"}
@@ -37,11 +37,11 @@ export class SessionHistoryWriter {
37
37
  /**
38
38
  * 追加一条 user 消息。
39
39
  */
40
- async appendUserMessage(params) {
40
+ async append_user_message(params) {
41
41
  try {
42
42
  const historyStore = this.getHistoryStore();
43
43
  if (params.message && typeof params.message === "object") {
44
- await historyStore.append(params.message);
44
+ await historyStore.write_record(params.message);
45
45
  void this.afterSessionUpdatedAsync();
46
46
  return;
47
47
  }
@@ -55,7 +55,7 @@ export class SessionHistoryWriter {
55
55
  extra: params.extra,
56
56
  },
57
57
  });
58
- await historyStore.append(message);
58
+ await historyStore.write_record(message);
59
59
  void this.afterSessionUpdatedAsync();
60
60
  }
61
61
  catch {
@@ -65,18 +65,18 @@ export class SessionHistoryWriter {
65
65
  /**
66
66
  * 追加一条 assistant 消息。
67
67
  */
68
- async appendAssistantMessage(params) {
68
+ async append_assistant_message(params) {
69
69
  try {
70
70
  const historyStore = this.getHistoryStore();
71
71
  if (params.message && typeof params.message === "object") {
72
- await historyStore.finalizeInflight(params.message);
72
+ await historyStore.finalize_inflight(params.message);
73
73
  void this.afterSessionUpdatedAsync();
74
74
  return;
75
75
  }
76
76
  const fallbackText = String(params.fallbackText || "").trim();
77
77
  if (!fallbackText)
78
78
  return;
79
- await historyStore.finalizeInflight(historyStore.assistantText({
79
+ await historyStore.finalize_inflight(historyStore.assistantText({
80
80
  text: fallbackText,
81
81
  metadata: {
82
82
  sessionId: this.sessionId,
@@ -1 +1 @@
1
- {"version":3,"file":"SessionHistoryWriter.js","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryWriter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,SAAS,CAAS;IAClB,eAAe,CAAiD;IAChE,sBAAsB,CAAyD;IAEhG,YAAY,OAAoC;QAC9C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,wBAAwB;QAC5B,IAAI,CAAC,IAAI,CAAC,sBAAsB;YAAE,OAAO;QACzC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,MAIvB;QACC,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,IAAI,MAAM,CAAC,OAAO,IAAI,OAA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E,YAAY;gBAClB,QAAQ,EAAE;oBACR,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;gBACD,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;aACjB,CAAC,CACH,CAAC;YACF,KAAK,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"SessionHistoryWriter.js","sourceRoot":"","sources":["../../../../src/executor/composer/history/SessionHistoryWriter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,SAAS,CAAS;IAClB,eAAe,CAAiD;IAChE,sBAAsB,CAAyD;IAEhG,YAAY,OAAoC;QAC9C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,wBAAwB;QAC5B,IAAI,CAAC,IAAI,CAAC,sBAAsB;YAAE,OAAO;QACzC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,MAIzB;QACC,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5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CAAC,aAAa,CAAC;gBACzB,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE;oBACR,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;gBACD,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;aACjB,CAAC,CACH,CAAC;YACF,KAAK,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;CACF"}
@@ -6,7 +6,7 @@
6
6
  * - 不负责 append / list / meta / compact 等落盘能力。
7
7
  * - JSONL 文件事实源由 `JsonlSessionHistoryStore` 承担。
8
8
  */
9
- import { type SessionMessageV1 } from "../../../../executor/types/SessionMessages.js";
9
+ import { type SessionRecordV1 } from "../../../../executor/types/SessionRecords.js";
10
10
  import type { SessionHistoryStore } from "../../../../executor/store/history/SessionHistoryStore.js";
11
11
  import type { SessionHistoryComposer, SessionHistoryPrepareInput } from "../../../composer/history/SessionHistoryComposer.js";
12
12
  /**
@@ -30,6 +30,6 @@ export declare class JsonlSessionHistoryComposer implements SessionHistoryCompos
30
30
  private readUserSessionMessageText;
31
31
  private hasTrailingUserQuery;
32
32
  private sanitizeMessages;
33
- prepare(input: SessionHistoryPrepareInput): Promise<SessionMessageV1[]>;
33
+ prepare(input: SessionHistoryPrepareInput): Promise<SessionRecordV1[]>;
34
34
  }
35
35
  //# sourceMappingURL=JsonlSessionHistoryComposer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonlSessionHistoryComposer.d.ts","sourceRoot":"","sources":["../../../../../src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACxE,QAAQ,CAAC,IAAI,4BAA4B;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBAEhC,OAAO,EAAE,kCAAkC;IAQvD,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,0BAA0B;IAkBlC,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,gBAAgB;IAiBlB,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CA6B9E"}
1
+ {"version":3,"file":"JsonlSessionHistoryComposer.d.ts","sourceRoot":"","sources":["../../../../../src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EACV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,qBAAa,2BAA4B,YAAW,sBAAsB;IACxE,QAAQ,CAAC,IAAI,4BAA4B;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBAEhC,OAAO,EAAE,kCAAkC;IAQvD,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,0BAA0B;IAkBlC,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,gBAAgB;IAiBlB,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CA6B7E"}