mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -103,7 +103,9 @@ function genericList(def: ResourceDef) {
|
||||
}
|
||||
const where = filters.length > 0 ? ` WHERE ${filters.join(' AND ')}` : '';
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+13
-4
@@ -26,7 +26,14 @@ vi.mock('./config.js', async () => {
|
||||
|
||||
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 { resolveSession, outboundDbPath, openInboundDb } from './session-manager.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
|
||||
const outDb = new Database(outboundDbPath('ag-1', session.id));
|
||||
outDb.prepare(
|
||||
`INSERT INTO messages_out (id, timestamp, kind, platform_id, channel_type, content)
|
||||
outDb
|
||||
.prepare(
|
||||
`INSERT INTO messages_out (id, timestamp, kind, platform_id, channel_type, content)
|
||||
VALUES (?, datetime('now'), 'chat', 'discord:456', 'discord', ?)`,
|
||||
).run('out-unauth', JSON.stringify({ text: 'sneaky' }));
|
||||
)
|
||||
.run('out-unauth', JSON.stringify({ text: 'sneaky' }));
|
||||
outDb.close();
|
||||
|
||||
const calls: string[] = [];
|
||||
|
||||
@@ -838,7 +838,6 @@ describe('agent-shared session resolution', () => {
|
||||
const { session } = resolveSession('ag-1', null, null, 'agent-shared');
|
||||
expect(session.messaging_group_id).toBeNull();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('agent-to-agent routing', () => {
|
||||
@@ -885,7 +884,12 @@ describe('agent-to-agent routing', () => {
|
||||
const { session: paSlackSession } = resolveSession('ag-pa', 'mg-slack', null, 'shared');
|
||||
|
||||
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,
|
||||
);
|
||||
|
||||
|
||||
@@ -328,7 +328,12 @@ describe('routeAgentMessage return-path', () => {
|
||||
// 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.
|
||||
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,
|
||||
);
|
||||
|
||||
@@ -353,7 +358,12 @@ describe('routeAgentMessage return-path', () => {
|
||||
// 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.
|
||||
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,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user