Skip to content

Commit ee326eb

Browse files
committed
Let the interface's memory flag follow the kernel, not the wish
MEMORY_WIRED becomes true because it now is: AgentOptions.history landed in de6889a, the session's turns are passed to runAgent, and the decision frames carry a bounded `earlier`. The note the interface shows while the agent cannot remember therefore disappears on its own. The flag stays a value rather than a comment. It is the one place this server states a capability, and the point of stating it in data is that it has to move when the capability moves -- including backwards, if the kernel ever stops accepting history. `history` is read from the session before runAgent, not after. The turn being run is appended on run:end, so reading first is what keeps a run from being handed its own answer as context. Verification (commands actually run): npx tsc --noEmit -> 0 errors GET /api/session -> memory=true two turns in one session, the second asking "what arguments does that function take?" -> the answer cites the first turn's list_dir output, which it could only know from the history
1 parent 1316b05 commit ee326eb

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎server.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,15 @@ const MAX_SESSIONS = 64
100100
* 生成器**现在能不能看到上文**,如实报给界面。
101101
*
102102
* 这是这个服务端唯一一处「说了还没做」的地方,所以它必须是数据而不是
103-
* 注释 —— 界面拿它决定要不要提示读者「它不记得上一句」。等内核接上
104-
* `AgentOptions.history`,把这里改成 `true` 就够了,提示自动消失。
103+
* 注释 —— 界面拿它决定要不要提示读者「它不记得上一句」。
105104
*
106-
* 一个会撒谎的界面比一个缺功能的界面糟得多。
105+
* **现在是 `true`**:`AgentOptions.history` 已落地(`de6889a`),
106+
* 判定帧也带上了有界的 `earlier`。界面那句提示会自动消失。
107+
*
108+
* 一个会撒谎的界面比一个缺功能的界面糟得多 —— 所以这个值是**跟着
109+
* 内核的实际能力走**的,不是跟着愿望走。内核要是哪天不收了,这里得翻回去。
107110
*/
108-
const MEMORY_WIRED = false
111+
const MEMORY_WIRED = true
109112

110113
const SESSIONS = new Map<string, Turn[]>()
111114

@@ -286,11 +289,13 @@ async function handleRun(req: IncomingMessage, res: ServerResponse, url: URL): P
286289
const provider = resolveProvider()
287290
const generator = resolveGenerator()
288291

289-
// 注意这里**没有** history —— 内核还不收这个字段(见上面「会话」一节)。
290-
// 会话已经记下来了,等 `AgentOptions.history` 落地,这里加一行即可。
292+
// 会话就是上文。**在 runAgent 之前读** —— 这一轮自己的问答
293+
// 要等跑完才记进去(见 `run:end` 那里),不该混进它自己的上文。
294+
const history = sessionOf(session)
291295
await runAgent({
292296
task,
293297
cwd,
298+
history,
294299
decider: new Decider({
295300
provider,
296301
meter,

0 commit comments

Comments
 (0)