All files / src/test/integration/real-providers prompts.ts

40% Statements 2/5
100% Branches 0/0
0% Functions 0/2
40% Lines 2/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114                    4x                                                                                                                                                                                       4x                      
/**
 * Minimal Cost Test Prompts
 *
 * Carefully crafted prompts designed to minimize token usage while
 * testing specific CLI behaviors. Each prompt aims for the smallest
 * possible API cost while still exercising the target functionality.
 *
 * Cost estimates assume Claude Sonnet pricing (~$3/M input, $15/M output).
 */
 
export const MINIMAL_PROMPTS = {
  /**
   * ~$0.01 - Cheapest done response
   * Tests: basic spawn → completion flow, status parsing
   */
  done: `Output exactly this JSON with no other text:
{"status":"done","result":"ok"}`,
 
  /**
   * ~$0.01 - Cheapest questions response
   * Tests: waiting_for_input status, questions array parsing
   */
  questions: `Output exactly this JSON with no other text:
{"status":"questions","questions":[{"id":"q1","question":"What is your name?"}]}`,
 
  /**
   * ~$0.03 - Slow task for timing tests
   * Tests: streaming during long-running task, crash recovery
   * Note: Agent may not actually wait 30 seconds, but will produce delayed output
   */
  slow: `Think through a simple problem step by step, counting from 1 to 10 slowly, then output:
{"status":"done","result":"counted to 10"}`,
 
  /**
   * ~$0.02 - Produces text deltas for streaming tests
   * Tests: text_delta event parsing, output buffering
   */
  streaming: `Count from 1 to 5, outputting each number, then output:
{"status":"done","result":"counted"}`,
 
  /**
   * ~$0.03 - Deliberately produces non-JSON first
   * Tests: schema validation failure, retry logic
   */
  badThenGood: `First say "thinking..." on its own line, then output:
{"status":"done","result":"fixed"}`,
 
  /**
   * ~$0.02 - Multiple questions
   * Tests: questions array with multiple items
   */
  multipleQuestions: `Output exactly this JSON with no other text:
{"status":"questions","questions":[{"id":"q1","question":"First question?"},{"id":"q2","question":"Second question?"}]}`,
 
  /**
   * ~$0.01 - Error signal
   * Tests: error status handling
   */
  error: `Output exactly this JSON with no other text:
{"status":"error","error":"Test error message"}`,
 
  /**
   * ~$0.02 - Answer continuation
   * Tests: session resume with answers
   */
  answerContinuation: (answers: Record<string, string>): string => {
    const answerLines = Object.entries(answers)
      .map(([id, answer]) => `${id}: ${answer}`)
      .join('\n');
    return `I received your answers:
${answerLines}
 
Now complete the task by outputting:
{"status":"done","result":"completed with answers"}`;
  },
 
  /**
   * ~$0.02 - Context complete for discuss mode
   * Tests: discuss mode output handling (now uses universal done signal)
   */
  discussComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,
 
  /**
   * ~$0.02 - Plan complete
   * Tests: plan mode output handling (now uses universal done signal)
   */
  planComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,
 
  /**
   * ~$0.02 - Detail complete
   * Tests: detail mode output handling (now uses universal done signal)
   */
  detailComplete: `Output exactly this JSON with no other text:
{"status":"done"}`,
} as const;
 
/**
 * Prompts specifically for Codex provider testing.
 * Codex may have different output format requirements.
 */
export const CODEX_PROMPTS = {
  /**
   * Basic completion for Codex
   */
  done: `Complete this simple task: output "done" and finish.`,
 
  /**
   * Produces streaming output
   */
  streaming: `Count from 1 to 5, saying each number aloud, then say "finished".`,
} as const;