feat(protocol): wire session aggregation and API with liveness
Finalizing the backend engine for the Operative Protocol. - Updated agent-sessions.ts to use the deriveLiveness logic and the 15m protocol threshold. - Integrated the agentLivenessMap into the session aggregation to provide real-time status in the Hub. - Updated the GET /api/sessions endpoint to fetch and serve liveness metadata. - Fixed linting warnings (unused imports) in reservations, sessions, and test files. This commit completes the backend contract for bb-u6f.6.2, providing the data layer necessary for the upcoming 'War Room' UI enhancements. OPERATIVE: silver-castle SESSION: 2026-02-14-1145
This commit is contained in:
parent
41f7cb8f24
commit
965d11c0b9
7 changed files with 48 additions and 15 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
createProtocolEvent,
|
||||
type ProtocolEvent
|
||||
createProtocolEvent
|
||||
} from '../../src/lib/agent-protocol';
|
||||
|
||||
test('createProtocolEvent generates a valid v1 envelope', () => {
|
||||
|
|
|
|||
|
|
@ -104,4 +104,14 @@ describe('Agent Sessions Aggregation', () => {
|
|||
const card = feed[0].tasks[0];
|
||||
assert.strictEqual(card.sessionState, 'stale');
|
||||
});
|
||||
|
||||
it('should reflect agent liveness (evicted) in session state', () => {
|
||||
const issues = [MOCK_ISSUE];
|
||||
const livenessMap = { 'agent-smith': 'evicted' };
|
||||
|
||||
const feed = buildSessionTaskFeed(issues, [], { messages: [] }, livenessMap);
|
||||
|
||||
const card = feed[0].tasks[0];
|
||||
assert.strictEqual(card.sessionState, 'evicted');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import fs from 'node:fs/promises';
|
|||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import { registerAgent, heartbeatAgent } from '../../src/lib/agent-registry';
|
||||
import { registerAgent } from '../../src/lib/agent-registry';
|
||||
import { reserveAgentScope } from '../../src/lib/agent-reservations';
|
||||
|
||||
async function withTempUserProfile(run: () => Promise<void>): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue