Emit shared PersonaState from repo Faces
This commit is contained in:
parent
d84052ad0a
commit
6bab44ba15
6 changed files with 1837 additions and 1 deletions
|
|
@ -60,11 +60,30 @@ try {
|
|||
|
||||
const structured = result.structuredContent;
|
||||
const typedState = structured?.typedState;
|
||||
const personaState = structured?.personaState;
|
||||
const faceAffect = typedState?.faceAffect;
|
||||
|
||||
if (!faceAffect || typeof faceAffect !== "object") {
|
||||
throw new Error(`read_repo_face_state did not expose typedState.faceAffect for ${identity}.`);
|
||||
}
|
||||
if (!personaState || typeof personaState !== "object") {
|
||||
throw new Error(`read_repo_face_state did not expose personaState for ${identity}.`);
|
||||
}
|
||||
if (personaState.schemaVersion !== "gamecult.persona_state.v0") {
|
||||
throw new Error(`personaState has wrong schemaVersion for ${identity}: ${personaState.schemaVersion ?? "(missing)"}.`);
|
||||
}
|
||||
if (personaState.provenance?.authority !== "projection") {
|
||||
throw new Error(`personaState provenance authority should be projection for ${identity}.`);
|
||||
}
|
||||
if (personaState.personaId !== structured?.identity?.id) {
|
||||
throw new Error(`personaState.personaId does not match identity id for ${identity}.`);
|
||||
}
|
||||
if (!Array.isArray(personaState.candidateActions?.actions)) {
|
||||
throw new Error(`personaState.candidateActions.actions is not an array for ${identity}.`);
|
||||
}
|
||||
if (!Array.isArray(personaState.affect?.socialBonds)) {
|
||||
throw new Error(`personaState.affect.socialBonds is not an array for ${identity}.`);
|
||||
}
|
||||
|
||||
for (const field of ["needs", "socialBonds", "statusReads", "moodDimensions", "socialBiases", "doctrineStances"]) {
|
||||
if (!Array.isArray(faceAffect[field])) {
|
||||
|
|
@ -81,6 +100,12 @@ try {
|
|||
ok: true,
|
||||
identity,
|
||||
faceStatePath: structured?.faceStatePath,
|
||||
personaState: {
|
||||
schemaVersion: personaState.schemaVersion,
|
||||
candidateActions: personaState.candidateActions.actions.length,
|
||||
needs: personaState.affect.needs.length,
|
||||
socialBonds: personaState.affect.socialBonds.length,
|
||||
},
|
||||
affect: {
|
||||
needs: faceAffect.needs.length,
|
||||
socialBonds: faceAffect.socialBonds.length,
|
||||
|
|
|
|||
Loading…
Reference in a new issue