fix: retain source continuation and explain request reservation pauses

This commit is contained in:
Agent Workbench Dev
2026-11-04 00:45:53 +08:00
parent fbedb7381b
commit 5dcd6d7c3f
30 changed files with 439 additions and 81 deletions
+13
View File
@@ -0,0 +1,13 @@
// Only a recorded source page can supply a continuation. A tool-result
// artifact restores that page, not bytes that have never been read.
export function fileContinuation(value) {
if (typeof value?.path !== 'string' || !/^[a-f0-9]{64}$/i.test(value.sha256 ?? '')
|| !Number.isSafeInteger(value.range_start_line) || !Number.isSafeInteger(value.range_end_line)
|| !Number.isSafeInteger(value.next_offset) || !Number.isSafeInteger(value.total_characters)) return null;
const more = value.next_offset < value.total_characters;
const next = more ? { path: value.path, start_line: value.range_start_line, end_line: value.range_end_line,
offset: value.next_offset, expected_sha256: value.sha256 }
: Number.isSafeInteger(value.next_start_line) ? { path: value.path, start_line: value.next_start_line,
expected_sha256: value.sha256 } : null;
return { range_complete: !more, next_read_file: next };
}