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
@@ -134,6 +134,9 @@ test('agent-tools exposes agent ops tools', async (t) => {
'get_hrpc_allowlist_status',
'emit_host_notification',
'request_host_action',
'discord_send_message',
'discord_channel_status',
'discord_read_inbox',
'autonomous_run',
'autonomous_run_status',
'autonomous_run_stop',
@@ -215,6 +218,14 @@ test('agent-tui embeds operating contract appendix', async (t) => {
t.ok(TUI.includes('BARE_OS_AGENT_DISCORD'))
t.ok(TUI.includes('verification_hints'))
t.ok(TUI.includes('NEVER ASK'))
t.ok(TUI.includes('YOU RUN THE TOOLS'))
t.ok(TUI.includes('The user never runs your tools'))
t.ok(TUI.includes('discord_send_message'))
t.ok(TUI.includes('DISCORD CHANNEL'))
t.ok(TUI.includes('The user is not your tool runner'))
t.ok(TUI.includes('You can create files, edit files'))
t.ok(TUI.includes('Never say you cannot write files'))
t.ok(TUI.includes('ONLY your final answer'))
t.ok(TUI.includes('Lead with tools'))
t.ok(TUI.includes('TOOL DISCIPLINE'))
t.ok(TUI.includes('WORK POLICY'))
@@ -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')
})