feat: add community publishing and news syndication
This commit is contained in:
@@ -1,66 +1,74 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildMechanicDeveloperPrompt, type AiMechanicDeveloperHandoff } from './mechanic-developer-handoff';
|
||||
import {
|
||||
buildMechanicDeveloperPrompt,
|
||||
type AiMechanicDeveloperHandoff,
|
||||
} from './mechanic-developer-handoff';
|
||||
|
||||
const handoff: AiMechanicDeveloperHandoff = {
|
||||
context: {
|
||||
sourceKind: 'talent',
|
||||
sourceName: 'Chain Reaction',
|
||||
sourceDescription: 'Every third critical hit transfers the mark to a nearby enemy.'
|
||||
},
|
||||
valueColumns: [
|
||||
{ key: 'tierI', variantKey: 'I', label: 'TIER I' },
|
||||
{ key: 'tierII', variantKey: 'II', label: 'TIER II' }
|
||||
],
|
||||
allowAssignedAbility: false,
|
||||
allowProtocolUpgradeScaling: false,
|
||||
transcript: [{
|
||||
questionId: 'transfer-target',
|
||||
question: 'How is the next target selected?',
|
||||
answer: 'Nearest enemy'
|
||||
}],
|
||||
response: {
|
||||
status: 'capability_gap',
|
||||
summary: 'The runtime cannot select a nearby transfer target.',
|
||||
assumptions: ['The third hit consumes the current mark.'],
|
||||
warnings: ['Target selection must be deterministic.'],
|
||||
gaps: [{
|
||||
area: 'runtime',
|
||||
requiredBehavior: 'Select the nearest eligible enemy.',
|
||||
whyUnsupported: 'The event has no ordered nearby-target collection.',
|
||||
developerChange: 'Add a deterministic nearby-target selector.',
|
||||
workaround: null
|
||||
}],
|
||||
meta: {
|
||||
requestId: 'req_gap_123',
|
||||
model: 'test-model',
|
||||
inputTokens: 100,
|
||||
outputTokens: 50,
|
||||
totalTokens: 150
|
||||
}
|
||||
}
|
||||
context: {
|
||||
sourceKind: 'talent',
|
||||
sourceName: 'Chain Reaction',
|
||||
sourceDescription:
|
||||
'Every third critical hit transfers the mark to a nearby enemy.',
|
||||
},
|
||||
valueColumns: [
|
||||
{ key: 'tierI', variantKey: 'I', label: 'TIER I' },
|
||||
{ key: 'tierII', variantKey: 'II', label: 'TIER II' },
|
||||
],
|
||||
allowAssignedAbility: false,
|
||||
allowProtocolUpgradeScaling: false,
|
||||
transcript: [
|
||||
{
|
||||
questionId: 'transfer-target',
|
||||
question: 'How is the next target selected?',
|
||||
answer: 'Nearest enemy',
|
||||
},
|
||||
],
|
||||
response: {
|
||||
status: 'capability_gap',
|
||||
summary: 'The runtime cannot select a nearby transfer target.',
|
||||
assumptions: ['The third hit consumes the current mark.'],
|
||||
warnings: ['Target selection must be deterministic.'],
|
||||
gaps: [
|
||||
{
|
||||
area: 'runtime',
|
||||
requiredBehavior: 'Select the nearest eligible enemy.',
|
||||
whyUnsupported: 'The event has no ordered nearby-target collection.',
|
||||
developerChange: 'Add a deterministic nearby-target selector.',
|
||||
workaround: null,
|
||||
},
|
||||
],
|
||||
meta: {
|
||||
requestId: 'req_gap_123',
|
||||
model: 'test-model',
|
||||
inputTokens: 100,
|
||||
outputTokens: 50,
|
||||
totalTokens: 150,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe('mechanic developer handoff prompt', () => {
|
||||
it('includes the exact analyzed source, clarification evidence, and required code change', () => {
|
||||
const prompt = buildMechanicDeveloperPrompt(handoff);
|
||||
it('includes the exact analyzed source, clarification evidence, and required code change', () => {
|
||||
const prompt = buildMechanicDeveloperPrompt(handoff);
|
||||
|
||||
expect(prompt).toContain(handoff.context.sourceDescription);
|
||||
expect(prompt).toContain('How is the next target selected?');
|
||||
expect(prompt).toContain('Answer: Nearest enemy');
|
||||
expect(prompt).toContain('Add a deterministic nearby-target selector.');
|
||||
expect(prompt).toContain('Assistant request ID: req_gap_123');
|
||||
expect(prompt).toContain('Persistence round-trips the new representation');
|
||||
});
|
||||
expect(prompt).toContain(handoff.context.sourceDescription);
|
||||
expect(prompt).toContain('How is the next target selected?');
|
||||
expect(prompt).toContain('Answer: Nearest enemy');
|
||||
expect(prompt).toContain('Add a deterministic nearby-target selector.');
|
||||
expect(prompt).toContain('Assistant request ID: req_gap_123');
|
||||
expect(prompt).toContain('Persistence round-trips the new representation');
|
||||
});
|
||||
|
||||
it('omits empty optional sections', () => {
|
||||
const prompt = buildMechanicDeveloperPrompt({
|
||||
...handoff,
|
||||
transcript: [],
|
||||
response: { ...handoff.response, assumptions: [], warnings: [] }
|
||||
});
|
||||
it('omits empty optional sections', () => {
|
||||
const prompt = buildMechanicDeveloperPrompt({
|
||||
...handoff,
|
||||
transcript: [],
|
||||
response: { ...handoff.response, assumptions: [], warnings: [] },
|
||||
});
|
||||
|
||||
expect(prompt).not.toContain('## Clarification history');
|
||||
expect(prompt).not.toContain('## Assumptions');
|
||||
expect(prompt).not.toContain('## Warnings');
|
||||
});
|
||||
expect(prompt).not.toContain('## Clarification history');
|
||||
expect(prompt).not.toContain('## Assumptions');
|
||||
expect(prompt).not.toContain('## Warnings');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user