chore: trace reserved turn refresh boundaries
This commit is contained in:
@@ -1714,6 +1714,14 @@ export const createReservedTurnHandler = async (options: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let generalCommand = options.reservedTurns.getGeneralTurn(currentGeneral.id, 0);
|
let generalCommand = options.reservedTurns.getGeneralTurn(currentGeneral.id, 0);
|
||||||
|
if ((process.env.CORE_AI_TRACE_GENERAL_IDS?.split(',') ?? []).includes(String(currentGeneral.id))) {
|
||||||
|
process.stdout.write(
|
||||||
|
`RESERVED_TURN_HANDLER_TRACE ${JSON.stringify({
|
||||||
|
generalId: currentGeneral.id,
|
||||||
|
action: generalCommand.action,
|
||||||
|
})}\n`
|
||||||
|
);
|
||||||
|
}
|
||||||
if (!isBlocked && generalCommand.action !== DEFAULT_ACTION) {
|
if (!isBlocked && generalCommand.action !== DEFAULT_ACTION) {
|
||||||
hasReservedTurn = true;
|
hasReservedTurn = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,6 +408,17 @@ export class InMemoryReservedTurnStore {
|
|||||||
orderBy: [{ turnIdx: 'asc' }],
|
orderBy: [{ turnIdx: 'asc' }],
|
||||||
});
|
});
|
||||||
this.generalTurns.set(generalId, buildTurnListFromRows(rows, this.maxGeneralTurns));
|
this.generalTurns.set(generalId, buildTurnListFromRows(rows, this.maxGeneralTurns));
|
||||||
|
if ((process.env.CORE_AI_TRACE_GENERAL_IDS?.split(',') ?? []).includes(String(generalId))) {
|
||||||
|
process.stdout.write(
|
||||||
|
`RESERVED_TURN_REFRESH_TRACE ${JSON.stringify({
|
||||||
|
generalId,
|
||||||
|
force,
|
||||||
|
firstAction: rows.find((row) => row.turnIdx === 0)?.actionCode ?? DEFAULT_TURN_ACTION,
|
||||||
|
dirty: this.dirtyGeneralIds.has(generalId),
|
||||||
|
leased: this.leasedGeneralIds.has(generalId),
|
||||||
|
})}\n`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async prefetchGeneralTurns(generalIds: number[]): Promise<void> {
|
async prefetchGeneralTurns(generalIds: number[]): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user