fix: adapt the bridge to omp 18.4.8 host differences
Validate / validate (push) Successful in 9m53s

- resolve the agent dir through the host getAgentDir() (registered by the composition root) instead of sniffing execPath/argv
- synthesize agent_settled from the first terminal agent_end on omp
- read the live model through ctx.models.current() and prefer it over the stored model on omp
- adapt omp Settings (reloadFromDisk, global enabledModels) at the SDK boundary and drop scoped-model persistence on omp
This commit is contained in:
evandrodevbr committed 2026-10-01 10:07:47 -03:00
1 parent 52c9fbeaf3
commit 2aefc7ef5a
12 files changed
+232 -55

No files matched your search

+35
View File
@@ -560,3 +560,38 @@ test("Lifecycle helpers register pi hooks and delegate to handlers", async () =>
"agent-end",
]);
});
test("Terminal agent_end synthesizes agent_settled only for hosts that never emit it", async () => {
const cases = [
{ settle: true, event: { messages: [] }, expected: ["agent-end", "agent-settled"] },
{ settle: true, event: { messages: [], willContinue: true }, expected: ["agent-end"] },
{ settle: false, event: { messages: [] }, expected: ["agent-end"] },
];
for (const { settle, event, expected } of cases) {
const harness = createLifecycleApiHarness();
const events: string[] = [];
registerTelegramLifecycleHooks(harness.api, {
settleOnTerminalAgentEnd: settle,
onSessionStart: async () => {},
onSessionShutdown: async () => {},
onBeforeAgentStart: () => undefined,
onModelSelect: () => {},
onAgentStart: async () => {},
onToolExecutionStart: () => {},
onToolExecutionEnd: () => {},
onMessageStart: async () => {},
onMessageUpdate: async () => {},
onAgentEnd: async () => {
events.push("agent-end");
},
onAgentSettled: () => {
events.push("agent-settled");
},
});
await getRequiredLifecycleHandler(harness.handlers, "agent_end")(
event,
createLifecycleContext(),
);
assert.deepEqual(events, expected, JSON.stringify({ settle, event }));
}
});