统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
This commit is contained in:
@@ -44,16 +44,24 @@ export function buildRuntimeItemAiPromptInput(
|
||||
): RuntimeItemAiPromptInput {
|
||||
const storyGraph = context.customWorldProfile?.storyGraph;
|
||||
const activeThreadSummary = (context.activeThreadIds ?? [])
|
||||
.map((threadId) =>
|
||||
[...(storyGraph?.visibleThreads ?? []), ...(storyGraph?.hiddenThreads ?? [])]
|
||||
.find((thread) => thread.id === threadId)?.title ?? threadId,
|
||||
.map(
|
||||
(threadId) =>
|
||||
[
|
||||
...(storyGraph?.visibleThreads ?? []),
|
||||
...(storyGraph?.hiddenThreads ?? []),
|
||||
].find((thread) => thread.id === threadId)?.title ?? threadId,
|
||||
)
|
||||
.join('、');
|
||||
|
||||
return {
|
||||
worldSummary: context.customWorldProfile?.summary ?? context.worldType ?? '未知世界',
|
||||
sceneSummary: [context.sceneName, context.sceneDescription].filter(Boolean).join(' / '),
|
||||
encounterSummary: [context.encounterNpcName, context.encounterContextText].filter(Boolean).join(' / '),
|
||||
worldSummary:
|
||||
context.customWorldProfile?.summary ?? context.worldType ?? '未知世界',
|
||||
sceneSummary: [context.sceneName, context.sceneDescription]
|
||||
.filter(Boolean)
|
||||
.join(' / '),
|
||||
encounterSummary: [context.encounterNpcName, context.encounterContextText]
|
||||
.filter(Boolean)
|
||||
.join(' / '),
|
||||
relatedNpcSummary: context.relatedNpcNarrativeProfile
|
||||
? `${context.encounterNpcName ?? '相关人物'}:公开面 ${context.relatedNpcNarrativeProfile.publicMask};当前压力 ${context.relatedNpcNarrativeProfile.immediatePressure}`
|
||||
: context.relatedNpcState
|
||||
@@ -74,21 +82,25 @@ export function buildRuntimeItemAiIntent(
|
||||
plan: RuntimeItemPlan,
|
||||
): RuntimeItemAiIntent {
|
||||
const anchorLabel = resolveAnchorLabel(plan.relationAnchor);
|
||||
const sourceSeed = sanitizeFragment(context.sceneName, 4)
|
||||
|| sanitizeFragment(context.customWorldProfile?.name, 4)
|
||||
|| sanitizeFragment(anchorLabel, 4)
|
||||
|| '旧誓';
|
||||
const sourceSeed =
|
||||
sanitizeFragment(context.sceneName, 4) ||
|
||||
sanitizeFragment(context.customWorldProfile?.name, 4) ||
|
||||
sanitizeFragment(anchorLabel, 4) ||
|
||||
'旧誓';
|
||||
const functionalBias: RuntimeItemAiIntent['desiredFunctionalBias'] = [];
|
||||
|
||||
if (plan.permanence === 'timed') {
|
||||
functionalBias.push(context.playerBuildGaps.includes('survival_gap') ? 'heal' : 'cooldown');
|
||||
functionalBias.push(
|
||||
context.playerBuildGaps.includes('survival_gap') ? 'heal' : 'cooldown',
|
||||
);
|
||||
}
|
||||
if (context.playerBuildGaps.includes('mana_gap')) functionalBias.push('mana');
|
||||
if (context.playerBuildGaps.includes('survival_gap')) functionalBias.push('guard');
|
||||
if (context.playerBuildGaps.includes('survival_gap'))
|
||||
functionalBias.push('guard');
|
||||
if (
|
||||
functionalBias.length <= 0
|
||||
|| context.playerBuildGaps.includes('finisher_gap')
|
||||
|| plan.itemKind === 'equipment'
|
||||
functionalBias.length <= 0 ||
|
||||
context.playerBuildGaps.includes('finisher_gap') ||
|
||||
plan.itemKind === 'equipment'
|
||||
) {
|
||||
functionalBias.push('damage');
|
||||
}
|
||||
@@ -96,37 +108,43 @@ export function buildRuntimeItemAiIntent(
|
||||
return {
|
||||
shortNameSeed: sourceSeed,
|
||||
sourcePhrase: anchorLabel,
|
||||
reasonToAppear: context.generationChannel === 'monster_drop'
|
||||
? `${anchorLabel}倒下后,${context.sceneName ?? '这片战场'}里最值得带走的残留被翻了出来。`
|
||||
: `${anchorLabel}与最近局势把它推到了你面前。`,
|
||||
reasonToAppear:
|
||||
context.generationChannel === 'monster_drop'
|
||||
? `${anchorLabel}倒下后,${context.sceneName ?? '这片战场'}里最值得带走的残留被翻了出来。`
|
||||
: `${anchorLabel}与最近局势把它推到了你面前。`,
|
||||
relationHooks: [
|
||||
context.encounterContextText ?? context.sceneName ?? anchorLabel,
|
||||
...context.recentActions,
|
||||
].filter(Boolean).slice(0, 2) as string[],
|
||||
desiredBuildTags: [...new Set([
|
||||
...plan.targetBuildDirection,
|
||||
...context.playerBuildTags.slice(0, 2),
|
||||
])].slice(0, 3),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.slice(0, 2) as string[],
|
||||
desiredBuildTags: [
|
||||
...new Set([
|
||||
...plan.targetBuildDirection,
|
||||
...context.playerBuildTags.slice(0, 2),
|
||||
]),
|
||||
].slice(0, 3),
|
||||
desiredFunctionalBias: [...new Set(functionalBias)].slice(0, 2),
|
||||
tone: context.generationChannel === 'monster_drop'
|
||||
? 'grim'
|
||||
: context.generationChannel === 'quest_reward'
|
||||
? 'ritual'
|
||||
: context.playerBuildGaps.includes('survival_gap')
|
||||
? 'survival'
|
||||
: 'martial',
|
||||
tone:
|
||||
context.generationChannel === 'monster_drop'
|
||||
? 'grim'
|
||||
: context.generationChannel === 'quest_reward'
|
||||
? 'ritual'
|
||||
: context.playerBuildGaps.includes('survival_gap')
|
||||
? 'survival'
|
||||
: 'martial',
|
||||
visibleClue:
|
||||
context.relatedNpcNarrativeProfile?.visibleLine
|
||||
?? `${anchorLabel}身上留下的旧痕`,
|
||||
context.relatedNpcNarrativeProfile?.visibleLine ??
|
||||
`${anchorLabel}身上留下的旧痕`,
|
||||
witnessMark:
|
||||
context.relatedNpcNarrativeProfile?.debtOrBurden
|
||||
?? `${anchorLabel}尚未散尽的使用痕`,
|
||||
context.relatedNpcNarrativeProfile?.debtOrBurden ??
|
||||
`${anchorLabel}尚未散尽的使用痕`,
|
||||
unfinishedBusiness:
|
||||
context.relatedNpcNarrativeProfile?.contradiction
|
||||
?? `${anchorLabel}背后还有没说完的问题`,
|
||||
context.relatedNpcNarrativeProfile?.contradiction ??
|
||||
`${anchorLabel}背后还有没说完的问题`,
|
||||
hiddenHook:
|
||||
context.relatedNpcNarrativeProfile?.taboo
|
||||
?? `${anchorLabel}为什么会在此刻重新出现`,
|
||||
context.relatedNpcNarrativeProfile?.taboo ??
|
||||
`${anchorLabel}为什么会在此刻重新出现`,
|
||||
reactionHooks: [
|
||||
...(context.relatedNpcNarrativeProfile?.reactionHooks ?? []),
|
||||
...(context.activeThreadIds ?? []),
|
||||
@@ -138,9 +156,9 @@ export function buildRuntimeItemAiIntent(
|
||||
? 'scene_relic'
|
||||
: plan.relationAnchor.type === 'monster'
|
||||
? 'monster_trophy'
|
||||
: plan.relationAnchor.type === 'npc'
|
||||
? 'npc_relic'
|
||||
: 'faction_issue',
|
||||
: plan.relationAnchor.type === 'npc'
|
||||
? 'npc_relic'
|
||||
: 'faction_issue',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -151,13 +169,12 @@ export function applyRuntimeItemNarrative(params: {
|
||||
intent: RuntimeItemAiIntent;
|
||||
}) {
|
||||
const fingerprint = buildRuntimeItemStoryFingerprint(params);
|
||||
const runtimeMetadata =
|
||||
params.item.runtimeMetadata ?? {
|
||||
origin: 'ai_compiled' as const,
|
||||
generationChannel: params.context.generationChannel,
|
||||
seedKey: `${params.context.generationChannel}:${params.item.id}`,
|
||||
sourceReason: params.intent.reasonToAppear,
|
||||
};
|
||||
const runtimeMetadata = params.item.runtimeMetadata ?? {
|
||||
origin: 'ai_compiled' as const,
|
||||
generationChannel: params.context.generationChannel,
|
||||
seedKey: `${params.context.generationChannel}:${params.item.id}`,
|
||||
sourceReason: params.intent.reasonToAppear,
|
||||
};
|
||||
|
||||
return {
|
||||
...params.item,
|
||||
@@ -178,14 +195,13 @@ export function applyRuntimeItemNarrativeToExistingItem(params: {
|
||||
preserveName?: boolean;
|
||||
}) {
|
||||
const fingerprint = buildRuntimeItemStoryFingerprint(params);
|
||||
const runtimeMetadata =
|
||||
params.item.runtimeMetadata ?? {
|
||||
origin: 'procedural' as const,
|
||||
generationChannel: params.context.generationChannel,
|
||||
relationAnchor: params.plan.relationAnchor,
|
||||
seedKey: `${params.context.generationChannel}:${params.item.id}`,
|
||||
sourceReason: params.intent.reasonToAppear,
|
||||
};
|
||||
const runtimeMetadata = params.item.runtimeMetadata ?? {
|
||||
origin: 'procedural' as const,
|
||||
generationChannel: params.context.generationChannel,
|
||||
relationAnchor: params.plan.relationAnchor,
|
||||
seedKey: `${params.context.generationChannel}:${params.item.id}`,
|
||||
sourceReason: params.intent.reasonToAppear,
|
||||
};
|
||||
|
||||
return {
|
||||
...params.item,
|
||||
@@ -195,19 +211,24 @@ export function applyRuntimeItemNarrativeToExistingItem(params: {
|
||||
description: buildCarrierNarrativeDescription(params),
|
||||
runtimeMetadata: {
|
||||
...runtimeMetadata,
|
||||
relationAnchor: runtimeMetadata.relationAnchor ?? params.plan.relationAnchor,
|
||||
relationAnchor:
|
||||
runtimeMetadata.relationAnchor ?? params.plan.relationAnchor,
|
||||
sourceReason: params.intent.reasonToAppear,
|
||||
storyFingerprint: fingerprint,
|
||||
},
|
||||
} satisfies InventoryItem;
|
||||
}
|
||||
|
||||
export function describeRuntimeRelationAnchor(anchor: RuntimeRelationAnchor | undefined) {
|
||||
export function describeRuntimeRelationAnchor(
|
||||
anchor: RuntimeRelationAnchor | undefined,
|
||||
) {
|
||||
if (!anchor) return '无明确锚点';
|
||||
return `${anchor.type}:${resolveAnchorLabel(anchor)}`;
|
||||
}
|
||||
|
||||
export function flattenDirectedRuntimeRewardItems(reward: DirectedRuntimeReward) {
|
||||
export function flattenDirectedRuntimeRewardItems(
|
||||
reward: DirectedRuntimeReward,
|
||||
) {
|
||||
return [
|
||||
...(reward.primaryItem ? [reward.primaryItem] : []),
|
||||
...reward.supportItems,
|
||||
|
||||
Reference in New Issue
Block a user