refactor: add authoritative revalidation on app resume and reconnect

This commit is contained in:
Mohamed Boudra
2026-03-06 16:24:12 +07:00
parent 5b270444d5
commit 7f29baf915
6 changed files with 280 additions and 147 deletions
@@ -1631,6 +1631,7 @@ describe('DaemonClient', () => {
payload: {
requestId: 'req-1',
agentId: 'agent_cli',
agent: null,
direction: 'tail',
projection: 'projected',
epoch: 'epoch-1',
@@ -1724,6 +1725,7 @@ describe('DaemonClient', () => {
payload: {
requestId: 'req-invalid',
agentId: 'agent_cli',
agent: null,
direction: 'tail',
projection: 'projected',
epoch: 'epoch-1',
+3
View File
@@ -5975,6 +5975,7 @@ export class Session {
try {
const snapshot = await this.ensureAgentLoaded(msg.agentId)
const agentPayload = await this.buildAgentPayload(snapshot)
let timeline = this.agentManager.fetchTimeline(msg.agentId, {
direction,
@@ -6065,6 +6066,7 @@ export class Session {
payload: {
requestId: msg.requestId,
agentId: msg.agentId,
agent: agentPayload,
direction,
projection,
epoch: timeline.epoch,
@@ -6090,6 +6092,7 @@ export class Session {
payload: {
requestId: msg.requestId,
agentId: msg.agentId,
agent: null,
direction,
projection,
epoch: '',
@@ -15,6 +15,7 @@ describe('shared messages stream parsing', () => {
payload: {
requestId: 'req-1',
agentId: 'agent_live',
agent: null,
direction: 'tail',
projection: 'projected',
epoch: 'epoch-1',
+1
View File
@@ -1594,6 +1594,7 @@ export const FetchAgentTimelineResponseMessageSchema = z.object({
payload: z.object({
requestId: z.string(),
agentId: z.string(),
agent: AgentSnapshotPayloadSchema.nullable(),
direction: z.enum(['tail', 'before', 'after']),
projection: z.enum(['projected', 'canonical']),
epoch: z.string(),