( context: DeveloperPromptContext | null, retryContext: Record<string, unknown> | null, )
| 1076 | } |
| 1077 | |
| 1078 | function buildTurnModeDeveloperInstructions( |
| 1079 | context: DeveloperPromptContext | null, |
| 1080 | retryContext: Record<string, unknown> | null, |
| 1081 | ): string { |
| 1082 | const effectiveMode = context?.mode ?? (retryContext ? 'retry-recovery' : 'standard'); |
| 1083 | const lines = ['CodexBridge turn mode:']; |
| 1084 | switch (effectiveMode) { |
| 1085 | case 'retry-recovery': |
| 1086 | lines.push('Retry recovery turn.'); |
| 1087 | lines.push('- This request is being retried on the same Codex thread after a manual stop.'); |
| 1088 | lines.push('- Reuse existing thread context when it helps, but answer the current request completely and directly.'); |
| 1089 | lines.push('- Treat the retry metadata below as context, not as a reason to skip a fresh answer.'); |
| 1090 | break; |
| 1091 | case 'command-skill-parser': |
| 1092 | lines.push('Command-skill parser.'); |
| 1093 | lines.push('- This is an internal parsing turn. Return only the structured result requested by the prompt or skill contract.'); |
| 1094 | lines.push('- Do not execute the requested action, persist state, fabricate confirmations, or continue as a normal user-facing conversation.'); |
| 1095 | if (context?.command) { |
| 1096 | lines.push(`- Command context: /${context.command}${context.subcommand ? ` ${context.subcommand}` : ''}`); |
| 1097 | } |
| 1098 | if (context?.operation) { |
| 1099 | lines.push(`- Bridge operation: ${context.operation}`); |
| 1100 | } |
| 1101 | break; |
| 1102 | case 'review-result-localizer': |
| 1103 | lines.push('Review result localizer.'); |
| 1104 | lines.push('- This is an internal localization turn. Preserve findings, severity labels, ordering, and code references exactly while localizing the text.'); |
| 1105 | lines.push('- Do not add, remove, soften, or invent findings, caveats, or recommendations unless the prompt explicitly asks.'); |
| 1106 | break; |
| 1107 | case 'agent-result-verifier': |
| 1108 | lines.push('Agent result verifier.'); |
| 1109 | lines.push('- This is an internal verification turn. Judge whether the provided result satisfies the job and return only the requested verification schema.'); |
| 1110 | lines.push('- Do not start new work, modify files, or produce a normal user-facing assistant reply.'); |
| 1111 | break; |
| 1112 | case 'standard': |
| 1113 | default: |
| 1114 | lines.push('Standard bridge turn.'); |
| 1115 | lines.push('- Produce the normal user-visible result for this turn unless another protocol block below makes this an internal parsing or localization task.'); |
| 1116 | lines.push('- Follow any attachment, retry, or plugin targeting protocol below only when its stated conditions apply.'); |
| 1117 | break; |
| 1118 | } |
| 1119 | if (context?.title && effectiveMode !== 'command-skill-parser') { |
| 1120 | lines.push(`- Internal task title: ${context.title}`); |
| 1121 | } |
| 1122 | return lines.join('\n'); |
| 1123 | } |
| 1124 | |
| 1125 | function buildRetryDeveloperInstructions(retryContext: Record<string, unknown> | null): string { |
| 1126 | if (!retryContext) { |
no outgoing calls
no test coverage detected