refactor(schedule): simplify request zone authority

This commit is contained in:
pku-xht
2026-08-06 19:33:19 +08:00
committed by Tianyi Cui
parent a667ec55d6
commit cd59acd6f6
25 changed files with 466 additions and 1007 deletions
+2 -23
View File
@@ -71,35 +71,14 @@ export class Inbox {
* @internal - The agent loop's step-boundary operation, not a plugin extension point.
*/
claim(target: InboxTarget, turn: number): UserMessage[] {
const claimed = this.claimRange('next-step', 0, this.nextStep.length, turn, false)
const claimed = this.mutate('next-step', 0, this.nextStep.length, [], false)
if (target === 'next-turn') {
claimed.push(...this.claimRange('next-turn', 0, 1, turn, false))
claimed.push(...this.mutate('next-turn', 0, 1, [], false))
}
for (const message of claimed) this.notifications.claimed(message, turn)
return claimed
}
/**
* Remove one contiguous pending range into an open turn without classifying
* it as cancellation. Concrete drivers may use this protected primitive to
* finish a private step-boundary drain while keeping {@link Inbox}'s public
* claim semantics unchanged.
* @internal
*/
private claimRange(
target: InboxTarget,
start: number,
count: number,
turn: number,
publish = true,
): UserMessage[] {
const claimed = this.mutate(target, start, count, [], false)
if (publish) {
for (const message of claimed) this.notifications.claimed(message, turn)
}
return claimed
}
/**
* Append one message to a pending list and durably record the insertion.
* @param target - pending list to extend.