Files
shd.build/src/lib/ai/mechanic-authoring.ts
T
jb dd84dff055
Validate and deploy production / validate (push) Successful in 23s
Validate and deploy staging / validate (push) Successful in 50s
Validate and deploy production / deploy (push) Failing after 40s
Validate and deploy staging / deploy (push) Failing after 7s
feat: add community publishing and news syndication
2026-08-01 21:42:09 -04:00

144 lines
3.3 KiB
TypeScript

import type { ConditionalMechanicDraftV1 } from '$lib/calculations/mechanic-editor';
export const AI_MECHANIC_SOURCE_KINDS = [
'talent',
'exotic_weapon_talent',
'os_protocol_talent',
'skill_chip_talent',
'specialization_tree_rank',
] as const;
export type AiMechanicSourceKind = (typeof AI_MECHANIC_SOURCE_KINDS)[number];
export const AI_MECHANIC_SOURCE_PROFILES = {
talent: {
variantKeys: ['I', 'II'],
allowAssignedAbility: false,
allowProtocolUpgradeScaling: false,
},
exotic_weapon_talent: {
variantKeys: ['I', 'II'],
allowAssignedAbility: false,
allowProtocolUpgradeScaling: false,
},
os_protocol_talent: {
variantKeys: ['base'],
allowAssignedAbility: false,
allowProtocolUpgradeScaling: true,
},
skill_chip_talent: {
variantKeys: ['minimum', 'maximum'],
allowAssignedAbility: true,
allowProtocolUpgradeScaling: false,
},
specialization_tree_rank: {
variantKeys: ['base'],
allowAssignedAbility: false,
allowProtocolUpgradeScaling: false,
},
} as const satisfies Record<
AiMechanicSourceKind,
{
variantKeys: readonly string[];
allowAssignedAbility: boolean;
allowProtocolUpgradeScaling: boolean;
}
>;
export type AiMechanicContext = {
sourceKind: AiMechanicSourceKind;
sourceName: string;
sourceDescription: string;
};
export type AiMechanicValueColumn = {
key: string;
variantKey: string;
label: string;
};
export type AiMechanicTranscriptEntry = {
questionId: string;
question: string;
answer: string | number | boolean;
};
export type AiMechanicAuthoringRequest = {
context: AiMechanicContext;
currentDraft: ConditionalMechanicDraftV1;
valueColumns: AiMechanicValueColumn[];
allowAssignedAbility: boolean;
allowProtocolUpgradeScaling: boolean;
transcript: AiMechanicTranscriptEntry[];
};
export type AiMechanicQuestion = {
id: string;
question: string;
reason: string;
answerType: 'text' | 'number' | 'choice' | 'boolean';
options: string[];
};
export type AiMechanicResponseMeta = {
requestId: string;
model: string;
inputTokens: number;
outputTokens: number;
totalTokens: number;
};
export type AiMechanicClarificationResponse = {
status: 'clarification_required';
summary: string;
assumptions: string[];
warnings: string[];
questions: AiMechanicQuestion[];
meta: AiMechanicResponseMeta;
};
export type AiMechanicDraftResponse = {
status: 'draft_ready';
draft: ConditionalMechanicDraftV1;
summary: string;
assumptions: string[];
warnings: string[];
pseudoScript: string;
meta: AiMechanicResponseMeta;
};
export type AiMechanicCapabilityGap = {
area:
| 'event'
| 'predicate'
| 'reducer'
| 'mutation'
| 'outcome'
| 'scope'
| 'value_reference'
| 'source_variant'
| 'runtime';
requiredBehavior: string;
whyUnsupported: string;
developerChange: string;
workaround: string | null;
};
export type AiMechanicCapabilityGapResponse = {
status: 'capability_gap';
summary: string;
assumptions: string[];
warnings: string[];
gaps: AiMechanicCapabilityGap[];
meta: AiMechanicResponseMeta;
};
export type AiMechanicAuthoringResponse =
| AiMechanicClarificationResponse
| AiMechanicDraftResponse
| AiMechanicCapabilityGapResponse;
export type AiMechanicAuthoringError = {
message: string;
};