refactor(agent): complete inbox lifecycle migration

This commit is contained in:
_Kerman
2026-08-03 12:25:33 +08:00
parent dc1d542092
commit 49e90695cc
214 changed files with 6019 additions and 4235 deletions

View File

@@ -51,6 +51,7 @@ function agentForCwd(cwd: string): Agent {
steer: () => {},
inject: () => { throw new Error('step-boundary catalog must not use agent.inject()') },
cancel() {},
runMaintenance: task => task(new AbortController().signal),
whenIdle: () => Promise.resolve(),
}
}
@@ -68,6 +69,7 @@ function sessionAgent(session: Session, id = 'tool-skill-agent'): Agent {
steer: () => {},
inject: () => { throw new Error('step-boundary catalog must not use agent.inject()') },
cancel() {},
runMaintenance: task => task(new AbortController().signal),
whenIdle: () => Promise.resolve(),
}
}
@@ -402,6 +404,26 @@ describe('dsh-tool-skill', () => {
expect(decision).toEqual({ kind: 'enter', messages: [] })
})
it('keeps a proposed catalog that already matches the current snapshot', async () => {
const home = await tempDir('tool-matching-proposal')
const ctx = await setup(home)
ctx.skills.register({
name: 'first-skill',
description: 'First skill',
source: 'runtime',
content: 'First body.',
})
const session = new Session(SessionId('matching-proposal'))
const proposed = createUserMessage({
content: catalogContent(['- `first-skill`: First skill']),
source: { kind: 'plugin', plugin: 'dsh-tool-skill' },
})
const decision = await proposeStep(ctx, sessionAgent(session), [proposed])
expect(decision).toEqual({ kind: 'enter', messages: [proposed] })
})
it('injects complete replacement catalogs for additions and an empty tombstone for removals', async () => {
const home = await tempDir('tool-dynamic-catalog')
const ctx = await setup(home)