feat: round-memory arbitrationRequested детектор маркера арбитража SP2d-a
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,3 +33,13 @@ function extractAddressee(body, label) {
|
||||
const mm = String(body || '').match(re);
|
||||
return mm ? mm[1].trim() : '';
|
||||
}
|
||||
|
||||
/** SP2d: контроллер просит арбитраж на ЛЮБОМ круге — маркер `**Арбитраж:** <причина>` в
|
||||
* артефакте (раздел «Переговоры»). Возвращает причину (truthy) или '' если маркера нет.
|
||||
* Карточка арбитража показывается при этом маркере независимо от круга (потолок ≤3 остаётся). */
|
||||
export function arbitrationRequested(md) {
|
||||
const text = typeof md === 'string' ? md : '';
|
||||
const m = text.match(/\*\*Арбитраж:\*\*\s*([^\n]*)/i);
|
||||
if (!m) return '';
|
||||
return m[1].trim() || 'арбитраж запрошен контроллером';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseNegotiationSection } from './negotiation-section.mjs';
|
||||
import { parseNegotiationSection, arbitrationRequested } from './negotiation-section.mjs';
|
||||
|
||||
const PLAN = `# План
|
||||
## Цель
|
||||
@@ -41,3 +41,18 @@ describe('parseNegotiationSection', () => {
|
||||
expect(parseNegotiationSection(null)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('arbitrationRequested (SP2d)', () => {
|
||||
it('нет маркера → пусто', () => {
|
||||
expect(arbitrationRequested('# План\n## Переговоры\n### Круг 1\n**Судье:** x')).toBe('');
|
||||
});
|
||||
it('маркер с причиной → причина', () => {
|
||||
expect(arbitrationRequested('## Переговоры\n**Арбитраж:** тупик по §4')).toBe('тупик по §4');
|
||||
});
|
||||
it('маркер без причины → truthy (дефолт)', () => {
|
||||
expect(arbitrationRequested('**Арбитраж:**')).toBeTruthy();
|
||||
});
|
||||
it('не строка → пусто', () => {
|
||||
expect(arbitrationRequested(null)).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user