Updates
Release rolling / release (push) Successful in 10m20s

This commit is contained in:
2026-08-18 20:01:31 -04:00
parent 4eb767d65e
commit d3aa66b0cc
32 changed files with 1671 additions and 190 deletions
@@ -901,3 +901,67 @@ test('dispatch delete / proc / run_command are open by default', async (t) => {
t.absent(blocked.ok)
t.is(blocked.error, 'command_denied')
})
test('discord_send_message queues or uses the live DM hook', async (t) => {
const s = loadDispatch()
const { vfs, files, b4a } = makeVfs({})
await vfs.writeFile(
'~/.discord/channel.json',
b4a.from(JSON.stringify({ userId: '111', open: true }) + '\n')
)
const paths = {
dir: '/home/guest/.agent',
config: '/home/guest/.agent/config.json',
cmdOut: '/tmp/agent.out'
}
const queued = await dispatch(s, {
ctx: { vfs, b4a },
paths,
toolName: 'discord_send_message',
args: { text: 'hello from agent' },
home: '/home/guest'
})
t.ok(queued.ok)
t.ok(queued.queued)
t.ok(files.has('~/.discord/outbox.json'))
t.ok(String(files.get('~/.discord/outbox.json')).includes('hello from agent'))
const sent = []
const live = await dispatch(s, {
ctx: {
vfs,
b4a,
bareOsDiscordSendDm: async (opts) => {
sent.push(opts)
return { ok: true, queued: false, userId: '111' }
}
},
paths,
toolName: 'discord_send_message',
args: { text: 'live ping' },
home: '/home/guest'
})
t.ok(live.ok)
t.absent(live.queued)
t.is(sent[0].text, 'live ping')
const empty = await dispatch(s, {
ctx: { vfs, b4a },
paths,
toolName: 'discord_send_message',
args: { text: ' ' },
home: '/home/guest'
})
t.absent(empty.ok)
t.is(empty.error, 'empty_message')
const st = await dispatch(s, {
ctx: { vfs, b4a },
paths,
toolName: 'discord_channel_status',
args: {},
home: '/home/guest'
})
t.ok(st.ok)
t.is(st.userId, '111')
})