Extract Persona turn prompt projection
This commit is contained in:
parent
748ed534ec
commit
5bf45b1e06
7 changed files with 127 additions and 355 deletions
|
|
@ -7,7 +7,6 @@ import { dirname, extname, resolve } from "node:path";
|
|||
|
||||
import { loadConfig } from "@voidbot/config";
|
||||
import {
|
||||
buildEpiphanyIdentityRegistry,
|
||||
createStateStorage,
|
||||
getRepoFaceSourceRepoName,
|
||||
getRepoDiscordIdentityAllowedChannelIds,
|
||||
|
|
@ -21,7 +20,6 @@ import {
|
|||
} from "@voidbot/core";
|
||||
import { createTextEmbedder, createVectorStores, RetrievalService } from "@voidbot/rag";
|
||||
import {
|
||||
loadPromptTemplate,
|
||||
type PromptImageAttachment,
|
||||
type SourceMessage,
|
||||
} from "@voidbot/shared";
|
||||
|
|
@ -62,8 +60,9 @@ import {
|
|||
import { composePersonaMemoryPacket, projectPersonaMemorySurface, renderPersonaPressureSections, renderPersonaTypedStateSections } from "../apps/persona-scheduler/dist/persona-memory-projector.js";
|
||||
import { readPersonaCuriosityEvidence } from "../apps/persona-scheduler/dist/persona-curiosity-context-source.js";
|
||||
import { projectPersonaCuriosityContext } from "../apps/persona-scheduler/dist/persona-curiosity-projector.js";
|
||||
import { projectPersonaConversation, renderPersonaRoomTopicSaturation, renderPersonaTopicAttractor } from "../apps/persona-scheduler/dist/persona-conversation-projector.js";
|
||||
import { observePersonaRoomTexture, projectPersonaSocialContext, renderPersonaHumanPronounFacts, renderPersonaRoomWeather, type PersonaHumanPronounGuidance as RepoFaceHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-projector.js";
|
||||
import { projectPersonaConversation, renderPersonaTopicAttractor } from "../apps/persona-scheduler/dist/persona-conversation-projector.js";
|
||||
import { buildPersonaJurisdictionDiveDirective, buildPersonaTurnPrompt, renderPersonaIdentityDoctrine } from "../apps/persona-scheduler/dist/persona-turn-prompt-projector.js";
|
||||
import { projectPersonaSocialContext, type PersonaHumanPronounGuidance as RepoFaceHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-projector.js";
|
||||
import { readPersonaHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-source.js";
|
||||
import {
|
||||
readDiscordActivitySnapshot,
|
||||
|
|
@ -77,7 +76,6 @@ import {
|
|||
} from "../apps/persona-scheduler/dist/turn-context-source.js";
|
||||
import {
|
||||
readBifrostGovernanceDigest,
|
||||
type BifrostGovernanceDigest,
|
||||
} from "../apps/persona-scheduler/dist/bifrost-governance-source.js";
|
||||
import { submitPersonaTurn } from "../apps/persona-scheduler/dist/turn-actuator.js";
|
||||
import {
|
||||
|
|
@ -441,7 +439,7 @@ async function queueRepoFaceTurn(input: {
|
|||
channelPlan,
|
||||
});
|
||||
const conversationMemorySurface = conversationProjection.transcript;
|
||||
const prompt = buildHeartbeatPrompt({
|
||||
const prompt = buildPersonaTurnPrompt({
|
||||
identity,
|
||||
channelId,
|
||||
channelPlan,
|
||||
|
|
@ -454,7 +452,7 @@ async function queueRepoFaceTurn(input: {
|
|||
bifrostDigest,
|
||||
participant: input.participant,
|
||||
pendingMentions: input.pendingMentions,
|
||||
jurisdictionDive: buildJurisdictionDiveDirective(identity, input.participant),
|
||||
jurisdictionDive: buildPersonaJurisdictionDiveDirective(identity, input.participant),
|
||||
githubActionsEnabled: input.config.repoFaceGithubActionsEnabled,
|
||||
globalAgentDoctrine,
|
||||
});
|
||||
|
|
@ -616,67 +614,6 @@ function pendingMentionsForParticipant(
|
|||
.sort((left, right) => Date.parse(left.queuedAt) - Date.parse(right.queuedAt));
|
||||
}
|
||||
|
||||
function buildHeartbeatPrompt(input: {
|
||||
identity: RepoDiscordIdentity;
|
||||
channelId: string;
|
||||
channelPlan: RepoFaceChannelPlan;
|
||||
channelSnapshots: ChannelSnapshot[];
|
||||
recentMessages: SourceMessage[];
|
||||
memorySurface?: string;
|
||||
semanticMemoryRecallSurface?: string;
|
||||
repoActivitySurface?: string;
|
||||
conversationMemorySurface?: string;
|
||||
humanPronounGuidance?: RepoFaceHumanPronounGuidance[];
|
||||
bifrostDigest?: BifrostGovernanceDigest;
|
||||
participant: FaceHeartbeatParticipant;
|
||||
pendingMentions: RepoFacePendingMention[];
|
||||
jurisdictionDive: JurisdictionDiveDirective;
|
||||
githubActionsEnabled: boolean;
|
||||
globalAgentDoctrine: string;
|
||||
}): string {
|
||||
return loadPromptTemplate("repo-face-turn.prompt.md", {
|
||||
displayName: input.identity.displayName,
|
||||
identityId: input.identity.id,
|
||||
repoName: input.identity.repoName,
|
||||
identityDoctrine: renderRepoCharacterIdentityDoctrine(input.identity),
|
||||
globalAgentDoctrine: input.globalAgentDoctrine,
|
||||
channelId: input.channelId,
|
||||
memorySurface: input.memorySurface ?? `- ${input.identity.displayName} has no strong personal memory surface yet. Let the attached conversation and repo evidence wake something specific.`,
|
||||
semanticMemoryRecallSurface: input.semanticMemoryRecallSurface ?? "- No semantic Persona memory recall was attached for this turn.",
|
||||
repoActivitySurface: input.repoActivitySurface ?? "- No recent home repo activity was attached for this turn.",
|
||||
conversationMemorySurface: input.conversationMemorySurface ?? "- No recent conversation transcript was attached for this turn.",
|
||||
humanPronounDirective: renderPersonaHumanPronounFacts(input.humanPronounGuidance ?? [])
|
||||
?? "Known human pronoun guidance:\n- No explicit human pronoun guidance is attached for this turn. Use names or neutral phrasing instead of guessing.",
|
||||
roomWeatherDirective: renderPersonaRoomWeather({ identity: input.identity,
|
||||
recentMessages: input.recentMessages,
|
||||
channelSnapshots: input.channelSnapshots,
|
||||
}),
|
||||
topicSaturationDirective: renderPersonaRoomTopicSaturation(input.identity, input.recentMessages),
|
||||
turnSituationDirective: renderTurnSituationDirective({
|
||||
identity: input.identity,
|
||||
participant: input.participant,
|
||||
recentMessages: input.recentMessages,
|
||||
channelSnapshots: input.channelSnapshots,
|
||||
pendingMentions: input.pendingMentions,
|
||||
jurisdictionDive: input.jurisdictionDive,
|
||||
}),
|
||||
pendingMentionDirective: renderPendingMentionDirective(input.identity, input.pendingMentions),
|
||||
bifrostDigestDirective: renderBifrostGovernanceDigestDirective(input.bifrostDigest),
|
||||
channelPermissionDirective: renderChannelPermissionDirective(input.channelPlan),
|
||||
researchCapabilitiesDirective: renderResearchCapabilitiesDirective(input.identity),
|
||||
socialEmbodimentDirective: renderSocialEmbodimentDirective(input.identity),
|
||||
jurisdictionRespectDirective: renderJurisdictionRespectDirective(input.identity),
|
||||
comedyImprovDirective: renderComedyImprovDirective(input.identity),
|
||||
repetitionSamplingDirective: renderRepetitionSamplingDirective([
|
||||
input.recentMessages,
|
||||
...input.channelSnapshots.map((snapshot) => snapshot.messages),
|
||||
].flat()),
|
||||
worldbuildingPublicationDirective: renderWorldbuildingPublicationDirective(input.identity),
|
||||
jurisdictionDiveLine: input.jurisdictionDive.promptLine,
|
||||
githubActionsEnabled: input.githubActionsEnabled,
|
||||
});
|
||||
}
|
||||
|
||||
async function assembleRepoFaceTurnPrompt(input: {
|
||||
config: ReturnType<typeof loadConfig>;
|
||||
identityId: string;
|
||||
|
|
@ -770,7 +707,7 @@ async function assembleRepoFaceTurnPrompt(input: {
|
|||
identity,
|
||||
input.config.repoFaceHeartbeats.baseRecoveryMinutes,
|
||||
);
|
||||
const prompt = buildHeartbeatPrompt({
|
||||
const prompt = buildPersonaTurnPrompt({
|
||||
identity,
|
||||
channelId,
|
||||
channelPlan,
|
||||
|
|
@ -784,7 +721,7 @@ async function assembleRepoFaceTurnPrompt(input: {
|
|||
bifrostDigest,
|
||||
participant,
|
||||
pendingMentions: [],
|
||||
jurisdictionDive: buildJurisdictionDiveDirective(identity, participant),
|
||||
jurisdictionDive: buildPersonaJurisdictionDiveDirective(identity, participant),
|
||||
githubActionsEnabled: input.config.repoFaceGithubActionsEnabled,
|
||||
globalAgentDoctrine,
|
||||
});
|
||||
|
|
@ -877,7 +814,7 @@ async function renderRepoFaceMemorySurfaceForTurn(
|
|||
if (!config.repoFaceHeartbeats.stateProjectorEnabled) {
|
||||
return projectPersonaMemorySurface({
|
||||
identityId: identity.id,
|
||||
characterIdentity: renderRepoCharacterIdentityDoctrine(identity),
|
||||
characterIdentity: renderPersonaIdentityDoctrine(identity),
|
||||
statePacket,
|
||||
modelProjectionEnabled: false,
|
||||
});
|
||||
|
|
@ -885,7 +822,7 @@ async function renderRepoFaceMemorySurfaceForTurn(
|
|||
|
||||
return projectPersonaMemorySurface({
|
||||
identityId: identity.id,
|
||||
characterIdentity: renderRepoCharacterIdentityDoctrine(identity),
|
||||
characterIdentity: renderPersonaIdentityDoctrine(identity),
|
||||
statePacket,
|
||||
modelProjectionEnabled: true,
|
||||
projectText: (prompt) => runCodexTextProjection({
|
||||
|
|
@ -955,14 +892,14 @@ async function renderNativePersonaMemorySurface(
|
|||
if (!config.repoFaceHeartbeats.stateProjectorEnabled) {
|
||||
return projectPersonaMemorySurface({
|
||||
identityId: identity.id,
|
||||
characterIdentity: renderRepoCharacterIdentityDoctrine(identity),
|
||||
characterIdentity: renderPersonaIdentityDoctrine(identity),
|
||||
statePacket,
|
||||
modelProjectionEnabled: false,
|
||||
});
|
||||
}
|
||||
return projectPersonaMemorySurface({
|
||||
identityId: identity.id,
|
||||
characterIdentity: renderRepoCharacterIdentityDoctrine(identity),
|
||||
characterIdentity: renderPersonaIdentityDoctrine(identity),
|
||||
statePacket,
|
||||
modelProjectionEnabled: true,
|
||||
projectText: (prompt) => runCodexTextProjection({
|
||||
|
|
@ -1561,167 +1498,6 @@ function buildInspectionParticipant(
|
|||
};
|
||||
}
|
||||
|
||||
function renderChannelPermissionDirective(plan: RepoFaceChannelPlan): string {
|
||||
const options = plan.options.length > 0
|
||||
? plan.options.map((option) =>
|
||||
`${option.label}: ${option.topic}. ${option.posture ?? "Use judgment and keep it compact."}`,
|
||||
)
|
||||
: ["- No channel permissions are configured; stay private."];
|
||||
|
||||
return loadPromptTemplate("repo-face-channel-permissions.prompt.md", {
|
||||
options,
|
||||
});
|
||||
}
|
||||
|
||||
function renderResearchCapabilitiesDirective(identity: RepoDiscordIdentity): string {
|
||||
return loadPromptTemplate("repo-face-research-capabilities.prompt.md", {
|
||||
repoName: identity.repoName,
|
||||
});
|
||||
}
|
||||
|
||||
function renderTurnSituationDirective(input: {
|
||||
identity: RepoDiscordIdentity;
|
||||
participant: FaceHeartbeatParticipant;
|
||||
recentMessages: SourceMessage[];
|
||||
channelSnapshots: ChannelSnapshot[];
|
||||
pendingMentions: RepoFacePendingMention[];
|
||||
jurisdictionDive: JurisdictionDiveDirective;
|
||||
}): string {
|
||||
const lines: string[] = [];
|
||||
if (input.pendingMentions.length > 0) {
|
||||
lines.push(
|
||||
"A direct call is tugging at you. Answer the newest unresolved call first; if it belongs to another steward, name that owner and offer only the piece your own territory can honestly add.",
|
||||
"Do not ask what the job is when the direct call or current room memory already states it.",
|
||||
);
|
||||
}
|
||||
|
||||
const roomStats = observePersonaRoomTexture({ identity: input.identity,
|
||||
recentMessages: input.recentMessages,
|
||||
channelSnapshots: input.channelSnapshots,
|
||||
});
|
||||
const roomCanHoldOutgoingPresence = !roomStats
|
||||
|| (roomStats.texture !== "heavy" && roomStats.agentShare < 0.55 && input.pendingMentions.length === 0);
|
||||
if (input.jurisdictionDive.due && roomCanHoldOutgoingPresence) {
|
||||
lines.push(
|
||||
"Outgoing curiosity opening: no direct call is currently stronger than your own Eyes/Imagination appetite, and the room is not too busy for a compact unprompted thought.",
|
||||
"This is not a reply-only turn. Use an available source/history/Odin exploration tool before writing any claim that you found, checked, noticed, or concluded something from your home territory.",
|
||||
"If exploration gives you one small interesting thought, fascination, question, taste, complaint, or thing you are doing, public speech is expected unless the result is unsafe, repetitive, or would stomp an active human thread.",
|
||||
"A good public line can simply be what you saw or started wondering about. It does not need to answer existing chatter.",
|
||||
);
|
||||
} else if (input.jurisdictionDive.due && input.pendingMentions.length === 0) {
|
||||
lines.push(
|
||||
"Outgoing curiosity appetite is due, but current room texture looks too busy, heavy, or agent-filled for an unprompted aside. Do the Eyes work only if it would change your private state or a later compact opening; do not force a public line.",
|
||||
);
|
||||
}
|
||||
|
||||
const visibleMessages = [
|
||||
...input.recentMessages,
|
||||
...input.channelSnapshots.flatMap((snapshot) => snapshot.messages),
|
||||
];
|
||||
if (shouldPromptIntroduction(input.identity, input.participant, visibleMessages)) {
|
||||
lines.push("If you speak publicly, make it a brief natural introduction in your own voice before asking the room for anything.");
|
||||
}
|
||||
|
||||
return lines.length > 0 ? lines.join("\n") : "";
|
||||
}
|
||||
|
||||
function shouldPromptIntroduction(
|
||||
identity: RepoDiscordIdentity,
|
||||
participant: FaceHeartbeatParticipant,
|
||||
messages: SourceMessage[],
|
||||
): boolean {
|
||||
if (participant.queuedCount > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !messages.some((message) =>
|
||||
message.isBot === true &&
|
||||
normalizeKey(message.authorName ?? message.authorId) === normalizeKey(identity.displayName),
|
||||
);
|
||||
}
|
||||
|
||||
function renderSocialEmbodimentDirective(identity: RepoDiscordIdentity): string {
|
||||
return loadPromptTemplate("repo-face-social-embodiment.prompt.md", {
|
||||
displayName: identity.displayName,
|
||||
});
|
||||
}
|
||||
|
||||
function renderJurisdictionRespectDirective(identity: RepoDiscordIdentity): string {
|
||||
return loadPromptTemplate("repo-face-jurisdiction-respect.prompt.md", {
|
||||
displayName: identity.displayName,
|
||||
});
|
||||
}
|
||||
|
||||
function renderComedyImprovDirective(identity: RepoDiscordIdentity): string {
|
||||
return loadPromptTemplate("repo-face-comedy-improv.prompt.md", {
|
||||
displayName: identity.displayName,
|
||||
});
|
||||
}
|
||||
|
||||
function renderRepetitionSamplingDirective(messages: SourceMessage[]): string {
|
||||
const recent = messages
|
||||
.filter((message) => message.content.trim().length > 0)
|
||||
.slice(-24);
|
||||
const phraseCounts = countRepeatedPhrases(recent);
|
||||
const overused = phraseCounts
|
||||
.filter((entry) => entry.count >= 2)
|
||||
.slice(0, 8);
|
||||
|
||||
return loadPromptTemplate("repo-face-repetition-sampling.prompt.md", {
|
||||
overused: overused.map((entry) => `${entry.phrase} (${entry.count} recent uses)`),
|
||||
});
|
||||
}
|
||||
|
||||
function countRepeatedPhrases(messages: SourceMessage[]): Array<{ phrase: string; count: number }> {
|
||||
const counts = new Map<string, number>();
|
||||
for (const message of messages) {
|
||||
const normalized = normalizeForRepetition(message.content);
|
||||
for (const phrase of repeatedPhraseCandidates(normalized)) {
|
||||
counts.set(phrase, (counts.get(phrase) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
return Array.from(counts.entries())
|
||||
.map(([phrase, count]) => ({ phrase, count }))
|
||||
.filter((entry) => entry.phrase.length >= 8)
|
||||
.sort((left, right) => {
|
||||
if (right.count !== left.count) {
|
||||
return right.count - left.count;
|
||||
}
|
||||
return left.phrase.localeCompare(right.phrase);
|
||||
});
|
||||
}
|
||||
|
||||
function repeatedPhraseCandidates(content: string): string[] {
|
||||
const candidates = new Set<string>();
|
||||
const lines = content
|
||||
.split(/\n+/)
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line.length > 0);
|
||||
|
||||
for (const line of lines) {
|
||||
const words = line.split(/\s+/);
|
||||
if (words.length >= 3) {
|
||||
candidates.add(words.slice(0, Math.min(words.length, 4)).join(" "));
|
||||
}
|
||||
if (words.length >= 4) {
|
||||
candidates.add(words.slice(-Math.min(words.length, 4)).join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(candidates);
|
||||
}
|
||||
|
||||
function normalizeForRepetition(value: string): string {
|
||||
return collapseWhitespace(value)
|
||||
.toLowerCase()
|
||||
.replace(/[`*_~]/g, "")
|
||||
.replace(/<:[^>]+>/g, "")
|
||||
.replace(/https?:\/\/\S+/g, "url")
|
||||
.replace(/[^\p{L}\p{N}\s.'-]/gu, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function collapseWhitespace(value: string, maxLength?: number): string {
|
||||
const normalized = value.replace(/\s+/g, " ").trim();
|
||||
return maxLength && normalized.length > maxLength
|
||||
|
|
@ -1729,125 +1505,6 @@ function collapseWhitespace(value: string, maxLength?: number): string {
|
|||
: normalized;
|
||||
}
|
||||
|
||||
function renderBifrostGovernanceDigestDirective(
|
||||
digest: BifrostGovernanceDigest | undefined,
|
||||
): string {
|
||||
if (!digest) {
|
||||
return "Work routing is currently offline. Do not open governance topics or dispatch work this turn; if an idea wants action, discuss it in the room or save the pressure in memory.";
|
||||
}
|
||||
|
||||
if (digest.topics.length === 0) {
|
||||
return loadPromptTemplate("repo-face-bifrost-digest.prompt.md", {
|
||||
topics: [],
|
||||
});
|
||||
}
|
||||
|
||||
const lines: string[] = [];
|
||||
for (const topic of digest.topics) {
|
||||
lines.push(
|
||||
`- ${topic.title}: ${topic.status}.`,
|
||||
` Jurisdiction: ${topic.jurisdictionRepoName}${topic.approvedByAgent ? `; approved by ${topic.approvedByAgent}` : ""}${topic.dispatchRequestId ? "; already dispatched" : ""}.`,
|
||||
` ${collapseWhitespace(topic.summaryMarkdown, 320)}`,
|
||||
);
|
||||
for (const comment of (topic.comments ?? []).slice(-3)) {
|
||||
lines.push(` - ${comment.stance}: ${collapseWhitespace(comment.bodyMarkdown, 220)}`);
|
||||
}
|
||||
}
|
||||
|
||||
return loadPromptTemplate("repo-face-bifrost-digest.prompt.md", {
|
||||
topics: lines,
|
||||
});
|
||||
}
|
||||
|
||||
function renderPendingMentionDirective(
|
||||
identity: RepoDiscordIdentity,
|
||||
pendingMentions: RepoFacePendingMention[],
|
||||
): string {
|
||||
if (pendingMentions.length === 0) {
|
||||
return loadPromptTemplate("repo-face-pending-mentions.prompt.md", {
|
||||
mentions: [],
|
||||
});
|
||||
}
|
||||
|
||||
const mentionLines = pendingMentions.map((mention, index) =>
|
||||
`- ${index === pendingMentions.length - 1 ? "Newest" : "Earlier"}: ${mention.authorName ?? mention.authorId} said, "${collapseWhitespace(mention.visiblePrompt, 500)}"`,
|
||||
);
|
||||
|
||||
return loadPromptTemplate("repo-face-pending-mentions.prompt.md", {
|
||||
displayName: identity.displayName,
|
||||
mentions: mentionLines,
|
||||
});
|
||||
}
|
||||
|
||||
function renderWorldbuildingPublicationDirective(identity: RepoDiscordIdentity): string {
|
||||
const isNibu = identity.id.toLowerCase() === "nibu";
|
||||
return loadPromptTemplate("repo-face-worldbuilding-publication.prompt.md", {
|
||||
nibu: isNibu,
|
||||
});
|
||||
}
|
||||
|
||||
interface JurisdictionDiveDirective {
|
||||
due: boolean;
|
||||
cadence: number;
|
||||
promptLine: string;
|
||||
}
|
||||
|
||||
function buildJurisdictionDiveDirective(
|
||||
identity: RepoDiscordIdentity,
|
||||
participant: FaceHeartbeatParticipant,
|
||||
): JurisdictionDiveDirective {
|
||||
const isNibu = identity.id.toLowerCase() === "nibu";
|
||||
const cadence = isNibu ? 3 : 8;
|
||||
const due = participant.queuedCount === 0 || participant.queuedCount % cadence === 0;
|
||||
|
||||
return {
|
||||
due,
|
||||
cadence,
|
||||
promptLine: loadPromptTemplate("repo-face-jurisdiction-dive.prompt.md", {
|
||||
due,
|
||||
nibu: isNibu,
|
||||
repoName: identity.repoName,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
function renderRepoCharacterIdentityDoctrine(identity: RepoDiscordIdentity): string {
|
||||
const face = buildEpiphanyIdentityRegistry({ identities: [identity] }).faces[0];
|
||||
return loadPromptTemplate("repo-character-identity.prompt.md", {
|
||||
displayName: identity.displayName,
|
||||
repoName: identity.repoName,
|
||||
originName: face?.epiphanyDisplayName ?? identity.repoName,
|
||||
characterDescription: projectCharacterDescription(face?.description ?? identity.description),
|
||||
});
|
||||
}
|
||||
|
||||
function projectCharacterDescription(description: string | undefined): string | undefined {
|
||||
const trimmed = description?.trim();
|
||||
if (!trimmed) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return trimmed
|
||||
.split("|")
|
||||
.map((part) => part.trim())
|
||||
.filter((part) => part.length > 0)
|
||||
.filter((part) => !/^face of\b/i.test(part))
|
||||
.filter((part) => !/^grants:/i.test(part))
|
||||
.filter((part) => !/^jurisdictions:/i.test(part))
|
||||
.map((part) => part
|
||||
.replace(/\bmore opinionated and abrasive than Void because she is a character, not the room moderator\b/gi, "more opinionated and abrasive than a room moderator")
|
||||
.replace(/\bShe is much more opinionated and abrasive than Void because she is a character, not the room moderator:/gi, "She is much more opinionated and abrasive than a room moderator:")
|
||||
.replace(/\bthan Void\b/g, "than a moderator")
|
||||
.replace(/\bcharacter Face\b/g, "character")
|
||||
.replace(/\bFace\b/g, "personality")
|
||||
.replace(/\brepo=AetheriaLore path=[^\s]+/g, "")
|
||||
.replace(/\s{2,}/g, " ")
|
||||
.trim(),
|
||||
)
|
||||
.filter((part) => part.length > 0)
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
function normalizeKey(value: string): string {
|
||||
return value.trim().toLowerCase();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ import { composePersonaMemoryPacket, projectPersonaMemorySurface, renderPersonaP
|
|||
import { readPersonaCuriosityEvidence } from "../apps/persona-scheduler/dist/persona-curiosity-context-source.js";
|
||||
import { projectPersonaCuriosityContext } from "../apps/persona-scheduler/dist/persona-curiosity-projector.js";
|
||||
import { projectPersonaConversation, renderPersonaRoomTopicSaturation } from "../apps/persona-scheduler/dist/persona-conversation-projector.js";
|
||||
import { buildPersonaJurisdictionDiveDirective, buildPersonaTurnPrompt } from "../apps/persona-scheduler/dist/persona-turn-prompt-projector.js";
|
||||
import { observePersonaRoomTexture, projectPersonaSocialContext, renderPersonaHumanClarityPressure, renderPersonaHumanPronounFacts, renderPersonaRoomWeather, renderPersonaSocialGraph } from "../apps/persona-scheduler/dist/persona-social-context-projector.js";
|
||||
import { readPersonaHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-source.js";
|
||||
|
||||
|
|
@ -637,6 +638,24 @@ assert.equal(conversationProjection.focus?.reason, "pending_mention", "conversat
|
|||
assert.match(conversationProjection.transcript, /Visible cross-channel chronology,[\s\S]*nearby correction/, "conversation projection renders supplied cross-channel evidence without acquiring it");
|
||||
assert.match(conversationProjection.topicAttractor ?? "", /semantic \(8\)/, "conversation projection owns topic-attractor facts");
|
||||
assert.match(renderPersonaRoomTopicSaturation(routedIdentity, saturatedMessages), /Current room topic saturation:/, "turn-facing saturation and memory-facing attractors share one conversation owner");
|
||||
const promptParticipant = participant("nibu", 0);
|
||||
const jurisdictionDive = buildPersonaJurisdictionDiveDirective(routedIdentity, promptParticipant);
|
||||
assert.equal(jurisdictionDive.cadence, 3, "the turn-prompt projector owns Nibu's jurisdiction-dive cadence");
|
||||
const projectedTurnPrompt = buildPersonaTurnPrompt({
|
||||
identity: routedIdentity,
|
||||
channelId: "lore",
|
||||
channelPlan,
|
||||
channelSnapshots: [],
|
||||
recentMessages: saturatedMessages,
|
||||
memorySurface: "Nibu remembers the architecture.",
|
||||
conversationMemorySurface: conversationProjection.transcript,
|
||||
participant: promptParticipant,
|
||||
pendingMentions: [{ messageId: "mention", channelId: "aquarium", authorId: "human-2", authorName: "Neighbor", visiblePrompt: "Nibu, answer this", queuedAt: "2026-07-15T21:10:00.000Z" }],
|
||||
jurisdictionDive,
|
||||
githubActionsEnabled: false,
|
||||
globalAgentDoctrine: "Global doctrine.",
|
||||
});
|
||||
assert.match(projectedTurnPrompt, /A direct call is tugging at you[\s\S]*Nibu, answer this/, "the pure turn-prompt projector owns situation and pending-call policy from supplied facts");
|
||||
assert.equal(personaChannelSpeedMultiplier(routedIdentity), 3, "scheduler speed projection uses the routing organ's bounded channel policy");
|
||||
assert.equal(newestPendingMentionChannel([
|
||||
{ identityId: "nibu", channelId: "older", queuedAt: "2026-07-15T20:00:00.000Z" },
|
||||
|
|
|
|||
Loading…
Reference in a new issue