|
| 1 | +import assert from 'node:assert/strict'; |
| 2 | +import test from 'node:test'; |
| 3 | +import { composeAgyPrompt, resolveAgyPromptOrder } from '../../src/agent/agy-prompt.js'; |
| 4 | + |
| 5 | + |
| 6 | +test('AGY-PROMPT-001: task-first remains the compatibility default', () => { |
| 7 | + const prompt = composeAgyPrompt('CURRENT', 'SYSTEM'); |
| 8 | + assert.ok(prompt.startsWith('[Current cli-jaw task]\nCURRENT')); |
| 9 | + assert.ok(prompt.endsWith('SYSTEM')); |
| 10 | +}); |
| 11 | + |
| 12 | +test('AGY-PROMPT-002: context-first keeps stable instructions first and current task last', () => { |
| 13 | + const prompt = composeAgyPrompt('HISTORY\nCURRENT', 'SYSTEM', 'context-first'); |
| 14 | + assert.ok(prompt.startsWith('[Operational Context — cli-jaw Integration]')); |
| 15 | + assert.ok(prompt.indexOf('SYSTEM') < prompt.indexOf('HISTORY')); |
| 16 | + assert.ok(prompt.endsWith('[Current cli-jaw task]\nHISTORY\nCURRENT')); |
| 17 | +}); |
| 18 | + |
| 19 | +test('AGY-PROMPT-003: unknown settings fail closed to task-first', () => { |
| 20 | + assert.equal(resolveAgyPromptOrder('context-first'), 'context-first'); |
| 21 | + assert.equal(resolveAgyPromptOrder('task-first'), 'task-first'); |
| 22 | + assert.equal(resolveAgyPromptOrder('unknown'), 'task-first'); |
| 23 | + assert.equal(resolveAgyPromptOrder(undefined), 'task-first'); |
| 24 | +}); |
| 25 | + |
| 26 | +test('AGY-PROMPT-004: no system prompt leaves the task untouched', () => { |
| 27 | + assert.equal(composeAgyPrompt('CURRENT', '', 'context-first'), 'CURRENT'); |
| 28 | +}); |
0 commit comments