Observe organizational Persona feedback

This commit is contained in:
Meta Vens 2026-07-18 20:32:29 +01:00
commit 7c0930bf93
13 changed files with 317 additions and 199 deletions

View file

@ -0,0 +1,13 @@
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { exportPersonaFeedbackObservation } from "../packages/core/src/persona-feedback-observation";
async function main(){let written: any;let puts=0;const node={put:async(_d:unknown,_k:string,v:unknown)=>{written=v;puts+=1;},get:()=>written};
const input={guildId:"g",channelId:"c",messageId:"m",authorId:"a",authorName:"human",observedAt:"2026-07-18T00:00:00Z",addressingMode:"role" as const,content:"please inspect this",targetPersonaId:"epiphany",targetRepoName:"GameCult/Epiphany",targetRuntimeId:"epiphany-yggdrasil"};
const config={storePath:"unused",bifrostRoot:"unused",producerRuntimeId:"voidbot-yggdrasil"};
const id=await exportPersonaFeedbackObservation(input,config,{definition:{},openNode:async()=>node});
assert.ok(id);assert.equal(written.authorityClass,"feedback_only");assert.equal(written.payloadHash,createHash("sha256").update("please inspect this").digest("hex"));assert.equal(written.targetRuntimeId,"epiphany-yggdrasil");
await exportPersonaFeedbackObservation(input,config,{definition:{},openNode:async()=>node});assert.equal(puts,1);
await assert.rejects(exportPersonaFeedbackObservation({...input,content:"different"},config,{definition:{},openNode:async()=>node}),/different immutable content/);
console.log("persona feedback observation smoke passed");}
void main().catch(error=>{console.error(error);process.exitCode=1;});

View file

@ -0,0 +1,35 @@
import { exportPersonaFeedbackObservation } from "../packages/core/src/persona-feedback-observation";
function arg(name: string): string {
const index = process.argv.indexOf(name);
const value = index >= 0 ? process.argv[index + 1] : undefined;
if (!value) throw new Error(`missing ${name}`);
return value;
}
async function main(): Promise<void> {
const eventId = await exportPersonaFeedbackObservation(
{
guildId: arg("--guild-id"),
channelId: arg("--channel-id"),
messageId: arg("--message-id"),
authorId: arg("--author-id"),
authorName: "fixture-human",
observedAt: "2026-07-18T00:00:00Z",
addressingMode: "role",
content: arg("--content"),
targetPersonaId: "epiphany",
targetRepoName: "GameCult/Epiphany",
targetRuntimeId: "epiphany-yggdrasil",
},
{
storePath: arg("--store"),
bifrostRoot: arg("--bifrost-root"),
producerRuntimeId: "voidbot-yggdrasil",
},
);
process.stdout.write(`${JSON.stringify({ eventId })}\n`);
}
void main();