@myagentroam/node 0.9.151 → 0.9.152
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const MAX_INITIAL_TURN_PAGE_SIZE = 30;
|
|
2
2
|
function conversationSegmentPrefix(turn) {
|
|
3
3
|
const user = turn.items.find((item) => item.kind === 'user_message');
|
|
4
4
|
const payload = typeof user?.payload === 'object' && user.payload !== null && !Array.isArray(user.payload)
|
|
@@ -89,14 +89,16 @@ export class ConversationSegmentService {
|
|
|
89
89
|
const boundary = input.cursor === undefined ? undefined : decodeCursor(input.cursor, session.id);
|
|
90
90
|
const collected = [];
|
|
91
91
|
const visited = new Set();
|
|
92
|
-
let turnCursor;
|
|
92
|
+
let turnCursor = boundary?.turnCursor ?? undefined;
|
|
93
|
+
let oldestTurnCursor = null;
|
|
93
94
|
let locatingBoundary = boundary !== undefined;
|
|
94
95
|
let hasOlder = false;
|
|
95
96
|
let metadata;
|
|
96
97
|
while (collected.length < limit) {
|
|
97
98
|
const page = await this.readTurns(session, {
|
|
98
99
|
...(turnCursor === undefined ? {} : { cursor: turnCursor }),
|
|
99
|
-
|
|
100
|
+
// Preserve the bounded live window without crossing its deferred history boundary.
|
|
101
|
+
limit: boundary === undefined ? Math.min(limit, MAX_INITIAL_TURN_PAGE_SIZE) : 1
|
|
100
102
|
});
|
|
101
103
|
metadata ??= {
|
|
102
104
|
snapshotSequence: page.snapshotSequence,
|
|
@@ -123,6 +125,7 @@ export class ConversationSegmentService {
|
|
|
123
125
|
const take = eligible.slice(-remaining);
|
|
124
126
|
hasOlder = eligible.length > take.length || page.nextCursor !== null;
|
|
125
127
|
collected.unshift(...take);
|
|
128
|
+
oldestTurnCursor = turnCursor ?? null;
|
|
126
129
|
}
|
|
127
130
|
if (boundary === undefined && page.deferredOlderHistory === true)
|
|
128
131
|
break;
|
|
@@ -140,7 +143,8 @@ export class ConversationSegmentService {
|
|
|
140
143
|
: encodeCursor({
|
|
141
144
|
version: 1,
|
|
142
145
|
sessionId: session.id,
|
|
143
|
-
beforeSegmentId: collected[0].id
|
|
146
|
+
beforeSegmentId: collected[0].id,
|
|
147
|
+
turnCursor: oldestTurnCursor
|
|
144
148
|
});
|
|
145
149
|
return {
|
|
146
150
|
...(metadata ?? {
|
|
@@ -164,7 +168,10 @@ function decodeCursor(value, sessionId) {
|
|
|
164
168
|
if (decoded.version !== 1 ||
|
|
165
169
|
decoded.sessionId !== sessionId ||
|
|
166
170
|
typeof decoded.beforeSegmentId !== 'string' ||
|
|
167
|
-
decoded.beforeSegmentId.length === 0
|
|
171
|
+
decoded.beforeSegmentId.length === 0 ||
|
|
172
|
+
(decoded.turnCursor !== undefined &&
|
|
173
|
+
decoded.turnCursor !== null &&
|
|
174
|
+
(typeof decoded.turnCursor !== 'string' || decoded.turnCursor.length === 0)))
|
|
168
175
|
throw new Error('EVENT_CURSOR_INVALID');
|
|
169
176
|
return decoded;
|
|
170
177
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.152",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"ws": "^8.21.3",
|
|
36
36
|
"zod": "4.4.3",
|
|
37
37
|
"@myagentroam/marctl": "0.9.120",
|
|
38
|
-
"@myagentroam/protocol": "0.9.
|
|
38
|
+
"@myagentroam/protocol": "0.9.152",
|
|
39
39
|
"@myagentroam/code-navigation": "0.9.129",
|
|
40
|
-
"@myagentroam/agent": "0.9.
|
|
40
|
+
"@myagentroam/agent": "0.9.152"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/ws": "^8.18.1"
|