Move Persona profile adapter into social source
This commit is contained in:
parent
489d06525c
commit
40675f101a
6 changed files with 47 additions and 32 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import type { loadConfig } from "@voidbot/config";
|
||||
import { createStateStorage } from "@voidbot/core";
|
||||
import type { InteractionMemoryProfile, SourceMessage } from "@voidbot/shared";
|
||||
import type { ChannelSnapshot } from "./turn-context-source.js";
|
||||
import type { PersonaHumanPronounGuidance } from "./persona-social-context-projector.js";
|
||||
|
|
@ -7,6 +9,30 @@ export interface PersonaInteractionProfileReader {
|
|||
close(): Promise<void>;
|
||||
}
|
||||
|
||||
export async function readStoredPersonaHumanPronounGuidance(input: {
|
||||
config: ReturnType<typeof loadConfig>;
|
||||
recentMessages: SourceMessage[];
|
||||
channelSnapshots: ChannelSnapshot[];
|
||||
}, dependencies: { openProfiles?: () => Promise<PersonaInteractionProfileReader> } = {}): Promise<PersonaHumanPronounGuidance[]> {
|
||||
return readPersonaHumanPronounGuidance({
|
||||
ownerActorId: input.config.ownerDiscordId,
|
||||
ownerFallbackName: "Metacrat",
|
||||
recentMessages: input.recentMessages,
|
||||
channelSnapshots: input.channelSnapshots,
|
||||
openProfiles: dependencies.openProfiles ?? (async () => {
|
||||
const storage = await createStateStorage({
|
||||
backend: input.config.stateStorageBackend,
|
||||
databaseDsn: input.config.databaseDsn,
|
||||
jobsFile: input.config.jobsFile,
|
||||
auditLogFile: input.config.auditLogFile,
|
||||
interactionMemoryFile: input.config.interactionMemoryFile,
|
||||
rateLimitStateFile: input.config.rateLimitStateFile,
|
||||
});
|
||||
return { getProfile: (actorId) => storage.interactionMemory.getProfile(actorId), close: () => storage.close() };
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function readPersonaHumanPronounGuidance(input: {
|
||||
ownerActorId: string;
|
||||
ownerFallbackName: string;
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou
|
|||
- Built-in Void CTB launch now crosses `void-moderation-turn-actuator.ts`. It alone writes the pending-mention handoff, quotes and launches the hidden PowerShell runner, polls lock/status witnesses, applies the handshake timeout, and returns the scheduler-facing receipt. The Persona shell decides only which participant kind to dispatch; it does not own platform process mechanics.
|
||||
- Global Codex doctrine discovery now crosses `global-agent-doctrine-source.ts`, which reports the first readable `AGENTS.md` authority or a typed unavailable observation with attempted paths and errors. `persona-turn-assembler.ts` alone lowers that observation into prompt text, so source failure cannot silently become invented doctrine and the shell no longer crawls user-home paths.
|
||||
- Persona Mind assembly now crosses `persona-memory-turn-coordinator.ts`. It sequences the existing typed state source, curiosity source/projector, state-packet projector, optional text-projection actuator, semantic memory source, and `persona-memory-recall-projector.ts` through narrow injected ports. Queued live turns and `--assemble-prompt` inspection now receive the same projected Mind and semantic-recall pair; the old shell accidentally omitted semantic recall from live turns. The coordinator does not select initiative, queue work, or mutate canonical Persona state.
|
||||
- Stored interaction-profile acquisition now enters through `readStoredPersonaHumanPronounGuidance` in `persona-social-context-source.ts`. The adapter owns opening the configured state provider and delegates visible-human selection, pronoun evidence precedence, and guaranteed close behavior to the existing source. The heartbeat shell no longer opens profile storage or manufactures a reader callback.
|
||||
- Direct Face `UPDATE REQUEST` and `BIFROST TOPIC` packets are ignored while `REPO_FACE_BIFROST_ENABLED=false`. Do not debug missing Bifrost jobs as a live failure unless that flag has been deliberately enabled again.
|
||||
- Live model-facing prompt prose has started moving out of executable code. The shared loader is `packages/shared/src/prompt-template.ts`; extracted prompt surfaces live under `prompts/`, including repo Face turn/reviewer prompts, provider wrapper prompts, situational social read prompts, source-grounding reminders, consensus-feed prompts, and repo Face model-smoke scenarios. Code should project data and select prompt names; prompt files should own behavioral prose.
|
||||
- Identity collapse has started. Active bot, worker, MCP repo-identity tools, and Face CTB scheduler paths now load through the canonical Face registry and treat repo Discord identities as compatibility projections. Next bounded move is to finish removing remaining direct conceptual dependence on repo identities, then split the Face turn loop into scheduler, context assembler, prompt renderer, candidate parser, policy gate, and transport adapter.
|
||||
|
|
|
|||
|
|
@ -47,11 +47,10 @@ import {
|
|||
type PersonaStateObservation,
|
||||
} from "../apps/persona-scheduler/dist/persona-state-source.js";
|
||||
import { projectNativePersonaBody } from "../apps/persona-scheduler/dist/persona-standard-state-projector.js";
|
||||
import type { PersonaHumanPronounGuidance as RepoFaceHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-projector.js";
|
||||
import { assemblePersonaTurn } from "../apps/persona-scheduler/dist/persona-turn-assembler.js";
|
||||
import { coordinatePersonaMemoryTurn } from "../apps/persona-scheduler/dist/persona-memory-turn-coordinator.js";
|
||||
import { readGlobalAgentDoctrine } from "../apps/persona-scheduler/dist/global-agent-doctrine-source.js";
|
||||
import { readPersonaHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-source.js";
|
||||
import { readStoredPersonaHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-source.js";
|
||||
import {
|
||||
readDiscordActivitySnapshot,
|
||||
type IdleCoolingSnapshot,
|
||||
|
|
@ -407,7 +406,7 @@ async function queueRepoFaceTurn(input: {
|
|||
recentMessages,
|
||||
channelSnapshots,
|
||||
};
|
||||
const humanPronounGuidance = await loadRepoFaceHumanPronounGuidance(input.config, roomContext);
|
||||
const humanPronounGuidance = await readStoredPersonaHumanPronounGuidance({ config: input.config, ...roomContext });
|
||||
const memoryContext = await coordinatePersonaMemoryTurn({
|
||||
identity,
|
||||
config: input.config,
|
||||
|
|
@ -534,7 +533,7 @@ async function assembleRepoFaceTurnPrompt(input: {
|
|||
recentMessages,
|
||||
channelSnapshots,
|
||||
};
|
||||
const humanPronounGuidance = await loadRepoFaceHumanPronounGuidance(input.config, roomContext);
|
||||
const humanPronounGuidance = await readStoredPersonaHumanPronounGuidance({ config: input.config, ...roomContext });
|
||||
const personaStateObservation = await readPersonaStateObservation({ identity, storageRoot: input.config.storageRoot });
|
||||
const projectedMemoryOverride = input.memorySurfacePath
|
||||
? await readOptionalMemorySurface(input.memorySurfacePath)
|
||||
|
|
@ -593,32 +592,6 @@ async function assembleRepoFaceTurnPrompt(input: {
|
|||
};
|
||||
}
|
||||
|
||||
async function loadRepoFaceHumanPronounGuidance(
|
||||
config: ReturnType<typeof loadConfig>,
|
||||
roomContext?: {
|
||||
recentMessages: SourceMessage[];
|
||||
channelSnapshots: ChannelSnapshot[];
|
||||
},
|
||||
): Promise<RepoFaceHumanPronounGuidance[]> {
|
||||
return readPersonaHumanPronounGuidance({
|
||||
ownerActorId: config.ownerDiscordId,
|
||||
ownerFallbackName: "Metacrat",
|
||||
recentMessages: roomContext?.recentMessages ?? [],
|
||||
channelSnapshots: roomContext?.channelSnapshots ?? [],
|
||||
openProfiles: async () => {
|
||||
const storage = await createStateStorage({
|
||||
backend: config.stateStorageBackend,
|
||||
databaseDsn: config.databaseDsn,
|
||||
jobsFile: config.jobsFile,
|
||||
auditLogFile: config.auditLogFile,
|
||||
interactionMemoryFile: config.interactionMemoryFile,
|
||||
rateLimitStateFile: config.rateLimitStateFile,
|
||||
});
|
||||
return { getProfile: (actorId) => storage.interactionMemory.getProfile(actorId), close: () => storage.close() };
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function renderRepoActivityObservation(observation: RepoActivityObservation): string {
|
||||
if (observation.status === "unconfigured") {
|
||||
return "- This Persona has no source repository configured; no repo activity was requested.";
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ import { projectGamecultPersonaState } from "../apps/persona-scheduler/dist/pers
|
|||
import { projectPersonaStatePacket } from "../apps/persona-scheduler/dist/persona-state-packet-projector.js";
|
||||
import { extractLastPersonaProjectionMessage, isRetryablePersonaProjectionFailure } from "../apps/persona-scheduler/dist/persona-text-projection-actuator.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";
|
||||
import { readPersonaHumanPronounGuidance, readStoredPersonaHumanPronounGuidance } from "../apps/persona-scheduler/dist/persona-social-context-source.js";
|
||||
|
||||
function participant(identityId: string, nextTurnAt: number): InitiativeParticipant {
|
||||
return {
|
||||
|
|
@ -503,6 +503,19 @@ const pronounGuidance = await readPersonaHumanPronounGuidance({
|
|||
});
|
||||
assert.match(pronounGuidance[0]?.evidenceExcerpt ?? "", /please use they\/them/, "the social-context source owns pronoun evidence precedence rather than favoring merely newer ambient usage");
|
||||
assert.equal(pronounReaderClosed, true, "the social-context source closes its injected interaction-profile reader");
|
||||
let storedProfileReaderClosed = false;
|
||||
const storedPronounGuidance = await readStoredPersonaHumanPronounGuidance({
|
||||
config: { ownerDiscordId: "human" } as never,
|
||||
recentMessages: [{ id: "human-pronouns", authorId: "human", authorName: "Operator", content: "hello", timestamp: "2026-07-15T21:00:00.000Z", isBot: false, channelId: "aquarium" }],
|
||||
channelSnapshots: [],
|
||||
}, {
|
||||
openProfiles: async () => ({
|
||||
getProfile: async () => ({ actorId: "human", actorName: "Operator", pronounPolicy: "explicit", resolvedPronounSet: "they/them", resolvedPronounSets: ["they/them"], pronounGuidance: "use they/them", pronounConfidence: 1, pronounEvidence: [{ pronounSet: "they/them", stance: "prefer", source: "explicit_self_statement", confidence: 1, timestamp: "2026-07-15T20:00:00.000Z", excerpt: "I use they/them" }], traits: [], notes: [], updatedAt: "2026-07-15T20:00:00.000Z" }),
|
||||
close: async () => { storedProfileReaderClosed = true; },
|
||||
}),
|
||||
});
|
||||
assert.equal(storedPronounGuidance[0]?.resolvedPronounSet, "they/them", "the stored-profile adapter feeds the existing social-context source without reimplementing pronoun policy");
|
||||
assert.equal(storedProfileReaderClosed, true, "the stored-profile adapter preserves provider close semantics");
|
||||
const clarityPressure = renderPersonaHumanClarityPressure({
|
||||
identity: routedIdentity,
|
||||
recentMessages: [
|
||||
|
|
|
|||
|
|
@ -434,3 +434,4 @@
|
|||
{"ts":"2026-07-16T04:35:00Z","type":"implementation","status":"ok","note":"Built-in Void CTB process mechanics moved into void-moderation-turn-actuator.ts: pending-mention handoff, PowerShell quoting, detached launch, handshake polling, timeout, and scheduler receipt. The shell lost 115 lines; focused smoke proves escaping, fail-closed missing handshake, exact mention handoff, and receipt semantics."}
|
||||
{"ts":"2026-07-16T04:45:00Z","type":"implementation","status":"ok","note":"Global Codex doctrine discovery moved into global-agent-doctrine-source.ts with typed provenance and unavailable evidence. persona-turn-assembler.ts now owns failure-to-prompt projection; the shell no longer crawls CODEX_HOME/USERPROFILE/home paths or authors fallback doctrine. Focused smoke proves candidate deduplication, first-readable authority, and explicit failure projection."}
|
||||
{"ts":"2026-07-16T05:05:00Z","type":"architecture","status":"ok","note":"Persona Mind assembly moved into persona-memory-turn-coordinator.ts with injected state, curiosity, projection, and recall ports; recall text moved into persona-memory-recall-projector.ts. This exposed and repaired a live/inspection divergence: queued turns previously omitted semantic Persona recall while inspection included it. Both paths now consume the same projected Mind plus recall pair; shell fell to 718 lines and typecheck/initiative/migration smokes pass."}
|
||||
{"ts":"2026-07-16T05:15:00Z","type":"implementation","status":"ok","note":"Configured interaction-profile acquisition moved into persona-social-context-source.ts as readStoredPersonaHumanPronounGuidance. The shell no longer opens state storage or builds a profile-reader adapter; focused smoke proves existing pronoun policy is reused and provider close semantics survive the concrete adapter."}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ active_subgoals:
|
|||
- `void-moderation-turn-actuator.ts` owns the Windows-specific built-in Void turn launch boundary: pending-attention handoff, PowerShell quoting and detached process launch, lock/status handshake polling, timeout, and scheduler receipt. The orchestration shell chooses the participant kind but cannot launch, poll, sleep, or infer success from process creation alone.
|
||||
- `global-agent-doctrine-source.ts` owns read-only candidate discovery and acquisition for global Codex `AGENTS.md` doctrine. It returns typed `ok` or `unavailable` evidence with provenance and errors; `persona-turn-assembler.ts` owns the prompt-facing failure projection. The shell cannot search home directories or invent fallback doctrine.
|
||||
- `persona-memory-turn-coordinator.ts` owns sequencing, not truth: it carries one typed Persona-state observation through curiosity evidence/projection, deterministic state-packet projection, optional text projection, and semantic recall, returning one projected Mind plus one recall surface. Each source/projector retains its own invariant and injected port. Live queued turns and inspection turns share this coordinator, so semantic recall can no longer exist only in inspection. `persona-memory-recall-projector.ts` alone lowers recall hits or unavailable evidence into prompt text.
|
||||
- `persona-social-context-source.ts` owns both the injected interaction-profile reader contract and the concrete configured-storage adapter. The adapter opens the provider and delegates visible-human selection, evidence precedence, and guaranteed close semantics to the source; the orchestration shell cannot open profile storage or duplicate pronoun policy.
|
||||
- `bifrost-governance-source.ts` owns the remaining Bifrost digest CLI adapter and converts command or parse failures into typed error topics. Persona prompt composition receives governance facts without knowing Bifrost process mechanics; `scripts/run-repo-face-heartbeats.ts` may not invoke the Bifrost CLI directly.
|
||||
- `initiative-engine.ts` is the only writer of scheduler state fields and history. Reconciliation, controls, pause/disabled skips, stale-turn recovery witnesses, semantic pressure, attention consumption, queue transitions, and tick finalization all cross named engine commit primitives. Queue/context actuators return results and cannot patch participants or history directly.
|
||||
- `turn-actuator.ts` owns lowering an assembled Persona prompt and evidence bundle into the canonical worker `ContextBundle` and approved `repo-face-rumination` job. It owns the worker actor, command, request ID, approval defaults, and `createJob` call, then returns only a queue receipt. The orchestration shell chooses no queue mechanics and the actuator cannot read Persona or initiative state.
|
||||
|
|
@ -288,4 +289,4 @@ rejected_paths:
|
|||
|
||||
current_status:
|
||||
summary: VoidBot's bot/worker/provider/RAG/Postgres/Qdrant/CultCache structure is live. Repo Face/persona heartbeat jobs run through the direct `openai_api` provider configured for MiMo `mimo-v2.5-pro`, with the expensive state-projector pass still disabled. The 2026-07-04 transport repair replaced the old Bifrost HTTP/token bridge shortcut with typed Bifrost CultMesh Discord command and receipt documents advertised in the Bifrost provider store at `cultmesh://asgard.starfire.bifrost/commands/discord-post`. VoidBot stores the Bifrost target as a CultMesh URI, writes command docs to `E:/Projects/Bifrost/.bifrost/provider-store.cc`, optionally pumps Bifrost's command processor, and waits for typed receipts before completing repo Face Discord delivery. Bifrost's provider advertisement exposes `discord.post` command metadata for Odin/Eve agents, and a bounded Weksa live-fire completed visibly. Eve live state now runs end to end through CultLib dev retained publications, Hermodr ordered SSE, Eve component bindings, and VoidBot typed control state. Receipts acknowledge intent only. Heat initial load, provider-driven change, and browser-command change were visibly verified without reload through the same subscription.
|
||||
next_action: Keep the Yggdrasil swarm paused. Extract the remaining interaction-profile acquisition adapter from `loadRepoFaceHumanPronounGuidance` in `scripts/run-repo-face-heartbeats.ts` so the shell no longer opens state storage to feed the existing social-context source. Preserve provider ownership and close semantics; do not move social projection or scheduler authority into the adapter. Do not unpause without an explicit controlled-live-fire decision.
|
||||
next_action: Keep the Yggdrasil swarm paused. Move the remaining repo-activity observation-to-text lowering from `scripts/run-repo-face-heartbeats.ts` into a pure projector beside `repo-activity-source.ts`, then make live and inspection assembly share it. Do not move exporter execution into the projector and do not unpause without an explicit controlled-live-fire decision.
|
||||
|
|
|
|||
Loading…
Reference in a new issue