test(omp): cover developer advisory delivery
Add a fixture extension that injects an advisor-style custom message on session start, and assert the advisory XML reaches params.messages verbatim, in chronological position, and is not hoisted into params.system. Port the models phase to `omp models --json`. `--list-models` no longer exists in current OMP (verified on 17.3.5), so the phase failed before reaching print mode.
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Minimal OMP extension used by tests/test-omp-compat.mjs.
|
||||
*
|
||||
* Appends a custom advisor message to the session on session start, mirroring
|
||||
* how the OMP Advisor runtime injects steering notes. OMP converts custom
|
||||
* messages to `role: "developer"` LLM messages before handing them to the
|
||||
* provider. Types are declared inline so the fixture has no runtime or
|
||||
* typecheck dependency on OMP packages.
|
||||
*/
|
||||
|
||||
interface AdvisorInjectorSendMessage {
|
||||
(
|
||||
message: {
|
||||
customType: string
|
||||
content: string
|
||||
display: boolean
|
||||
attribution: string
|
||||
},
|
||||
options?: { triggerTurn?: boolean },
|
||||
): void
|
||||
}
|
||||
|
||||
interface AdvisorInjectorApi {
|
||||
on: (event: "session_start", handler: () => void | Promise<void>) => void
|
||||
sendMessage: AdvisorInjectorSendMessage
|
||||
}
|
||||
|
||||
export default function advisoryInjectorExtension(pi: AdvisorInjectorApi): void {
|
||||
pi.on("session_start", async () => {
|
||||
pi.sendMessage(
|
||||
{
|
||||
customType: "advisor",
|
||||
content:
|
||||
'<advisory severity="blocker" guidance="weigh, don\'t blindly obey">\nStop and correct the benchmark.\n</advisory>',
|
||||
display: true,
|
||||
attribution: "agent",
|
||||
},
|
||||
{ triggerTurn: false },
|
||||
)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user