fix(core): preserve developer messages
OMP converts custom and hook messages (advisor notes, todo reminders, retry nudges) to role "developer" before calling the provider. messagesToCC() only handled user, assistant, and toolResult, so those messages were dropped before params.messages was sent to /alpha/generate. Steering still interrupted pending tools, but the model never saw the message content. /alpha/generate has no developer role: the official command-code CLI (0.32.3) only emits user, assistant, and tool messages plus a separate params.system. Forward developer messages as user messages with identical content in the same chronological position. Hoisting them into params.system would turn a mid-conversation note into a global top-priority instruction.
This commit is contained in:
+6
-1
@@ -190,7 +190,12 @@ export function messagesToCC(
|
||||
const pairedToolCallIds = completeToolCallIds(messages)
|
||||
|
||||
for (const message of messages ?? []) {
|
||||
if (message.role === "user") {
|
||||
if (message.role === "user" || message.role === "developer") {
|
||||
// Hosts such as OMP steer the agent by injecting developer-role messages
|
||||
// (advisor notes, reminders, nudges) mid-conversation. /alpha/generate
|
||||
// only accepts user, assistant, and tool roles, so degrade the role to
|
||||
// user instead of dropping the message. Content and chronological
|
||||
// position are preserved; system-prompt hoisting would change semantics.
|
||||
out.push({
|
||||
role: "user",
|
||||
content: userContentToCommandCode(message.content, allowImages),
|
||||
|
||||
Reference in New Issue
Block a user