style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,9 @@ function genericList(def: ResourceDef) {
|
|||||||
}
|
}
|
||||||
const where = filters.length > 0 ? ` WHERE ${filters.join(' AND ')}` : '';
|
const where = filters.length > 0 ? ` WHERE ${filters.join(' AND ')}` : '';
|
||||||
params.push(limit);
|
params.push(limit);
|
||||||
return getDb().prepare(`SELECT ${cols} FROM ${def.table}${where} LIMIT ?`).all(...params);
|
return getDb()
|
||||||
|
.prepare(`SELECT ${cols} FROM ${def.table}${where} LIMIT ?`)
|
||||||
|
.all(...params);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,14 @@ vi.mock('./config.js', async () => {
|
|||||||
|
|
||||||
const TEST_DIR = '/tmp/nanoclaw-test-delivery';
|
const TEST_DIR = '/tmp/nanoclaw-test-delivery';
|
||||||
|
|
||||||
import { initTestDb, closeDb, runMigrations, createAgentGroup, createMessagingGroup, createMessagingGroupAgent } from './db/index.js';
|
import {
|
||||||
|
initTestDb,
|
||||||
|
closeDb,
|
||||||
|
runMigrations,
|
||||||
|
createAgentGroup,
|
||||||
|
createMessagingGroup,
|
||||||
|
createMessagingGroupAgent,
|
||||||
|
} from './db/index.js';
|
||||||
import { getDeliveredIds } from './db/session-db.js';
|
import { getDeliveredIds } from './db/session-db.js';
|
||||||
import { resolveSession, outboundDbPath, openInboundDb } from './session-manager.js';
|
import { resolveSession, outboundDbPath, openInboundDb } from './session-manager.js';
|
||||||
import { deliverSessionMessages, setDeliveryAdapter } from './delivery.js';
|
import { deliverSessionMessages, setDeliveryAdapter } from './delivery.js';
|
||||||
@@ -233,10 +240,12 @@ describe('deliverSessionMessages — permission check', () => {
|
|||||||
|
|
||||||
// Insert an outbound message targeting mg-2 (discord) — not the origin chat
|
// Insert an outbound message targeting mg-2 (discord) — not the origin chat
|
||||||
const outDb = new Database(outboundDbPath('ag-1', session.id));
|
const outDb = new Database(outboundDbPath('ag-1', session.id));
|
||||||
outDb.prepare(
|
outDb
|
||||||
`INSERT INTO messages_out (id, timestamp, kind, platform_id, channel_type, content)
|
.prepare(
|
||||||
|
`INSERT INTO messages_out (id, timestamp, kind, platform_id, channel_type, content)
|
||||||
VALUES (?, datetime('now'), 'chat', 'discord:456', 'discord', ?)`,
|
VALUES (?, datetime('now'), 'chat', 'discord:456', 'discord', ?)`,
|
||||||
).run('out-unauth', JSON.stringify({ text: 'sneaky' }));
|
)
|
||||||
|
.run('out-unauth', JSON.stringify({ text: 'sneaky' }));
|
||||||
outDb.close();
|
outDb.close();
|
||||||
|
|
||||||
const calls: string[] = [];
|
const calls: string[] = [];
|
||||||
|
|||||||
@@ -838,7 +838,6 @@ describe('agent-shared session resolution', () => {
|
|||||||
const { session } = resolveSession('ag-1', null, null, 'agent-shared');
|
const { session } = resolveSession('ag-1', null, null, 'agent-shared');
|
||||||
expect(session.messaging_group_id).toBeNull();
|
expect(session.messaging_group_id).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('agent-to-agent routing', () => {
|
describe('agent-to-agent routing', () => {
|
||||||
@@ -885,7 +884,12 @@ describe('agent-to-agent routing', () => {
|
|||||||
const { session: paSlackSession } = resolveSession('ag-pa', 'mg-slack', null, 'shared');
|
const { session: paSlackSession } = resolveSession('ag-pa', 'mg-slack', null, 'shared');
|
||||||
|
|
||||||
await routeAgentMessage(
|
await routeAgentMessage(
|
||||||
{ id: 'out-a2a-1', platform_id: 'ag-researcher', content: JSON.stringify({ text: 'research this' }), in_reply_to: null },
|
{
|
||||||
|
id: 'out-a2a-1',
|
||||||
|
platform_id: 'ag-researcher',
|
||||||
|
content: JSON.stringify({ text: 'research this' }),
|
||||||
|
in_reply_to: null,
|
||||||
|
},
|
||||||
paSlackSession,
|
paSlackSession,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -328,7 +328,12 @@ describe('routeAgentMessage return-path', () => {
|
|||||||
// B replies to A, but in_reply_to references the C-originated row.
|
// B replies to A, but in_reply_to references the C-originated row.
|
||||||
// Guard rejects (SC belongs to C, not A) → falls through to newest of A.
|
// Guard rejects (SC belongs to C, not A) → falls through to newest of A.
|
||||||
await routeAgentMessage(
|
await routeAgentMessage(
|
||||||
{ id: 'msg-reply-tamper', platform_id: A, content: JSON.stringify({ text: 'misdirected' }), in_reply_to: cInboundId },
|
{
|
||||||
|
id: 'msg-reply-tamper',
|
||||||
|
platform_id: A,
|
||||||
|
content: JSON.stringify({ text: 'misdirected' }),
|
||||||
|
in_reply_to: cInboundId,
|
||||||
|
},
|
||||||
SB,
|
SB,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -353,7 +358,12 @@ describe('routeAgentMessage return-path', () => {
|
|||||||
// B replies to A with in_reply_to pointing to the channel message.
|
// B replies to A with in_reply_to pointing to the channel message.
|
||||||
// source_session_id is null → peer-affinity finds nothing → newest of A.
|
// source_session_id is null → peer-affinity finds nothing → newest of A.
|
||||||
await routeAgentMessage(
|
await routeAgentMessage(
|
||||||
{ id: 'msg-reply-channel', platform_id: A, content: JSON.stringify({ text: 'response' }), in_reply_to: 'channel-msg-1' },
|
{
|
||||||
|
id: 'msg-reply-channel',
|
||||||
|
platform_id: A,
|
||||||
|
content: JSON.stringify({ text: 'response' }),
|
||||||
|
in_reply_to: 'channel-msg-1',
|
||||||
|
},
|
||||||
SB,
|
SB,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user