feat: add structured room role metadata
This commit is contained in:
@@ -19,6 +19,10 @@ import {
|
||||
CodexAppServerClient,
|
||||
type AppServerInputItem,
|
||||
} from './app-server-client.js';
|
||||
import {
|
||||
prependRoomRoleHeader,
|
||||
type RoomRoleContext,
|
||||
} from './room-role-context.js';
|
||||
|
||||
// ── Types ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -31,6 +35,7 @@ interface ContainerInput {
|
||||
isScheduledTask?: boolean;
|
||||
assistantName?: string;
|
||||
agentType?: string;
|
||||
roomRoleContext?: RoomRoleContext;
|
||||
}
|
||||
|
||||
interface ContainerOutput {
|
||||
@@ -464,6 +469,7 @@ async function main(): Promise<void> {
|
||||
if (pending.length > 0) {
|
||||
prompt += '\n' + pending.join('\n');
|
||||
}
|
||||
prompt = prependRoomRoleHeader(prompt, containerInput.roomRoleContext);
|
||||
|
||||
try {
|
||||
log('Runtime selected: app-server');
|
||||
|
||||
23
runners/codex-runner/src/room-role-context.ts
Normal file
23
runners/codex-runner/src/room-role-context.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export interface RoomRoleContext {
|
||||
serviceId: string;
|
||||
role: 'owner' | 'reviewer';
|
||||
ownerServiceId: string;
|
||||
reviewerServiceId: string;
|
||||
failoverOwner: boolean;
|
||||
}
|
||||
|
||||
export function prependRoomRoleHeader(
|
||||
prompt: string,
|
||||
roomRoleContext?: RoomRoleContext,
|
||||
): string {
|
||||
if (!roomRoleContext) {
|
||||
return prompt;
|
||||
}
|
||||
|
||||
const header =
|
||||
`[ROOM_ROLE self=${roomRoleContext.serviceId} role=${roomRoleContext.role} ` +
|
||||
`owner=${roomRoleContext.ownerServiceId} reviewer=${roomRoleContext.reviewerServiceId} ` +
|
||||
`failover=${roomRoleContext.failoverOwner ? 1 : 0}]`;
|
||||
|
||||
return `${header}\n\n${prompt}`;
|
||||
}
|
||||
Reference in New Issue
Block a user