Restore VoidBot swarm speech and dashboard publication
This commit is contained in:
parent
167a214098
commit
12e566b62f
17 changed files with 2679 additions and 32 deletions
|
|
@ -36,6 +36,7 @@ const jurisdictionSchema = z.object({
|
|||
|
||||
const faceIdentitySchema = z.object({
|
||||
id: z.string().trim().min(1),
|
||||
identityKind: z.enum(["repo_face", "native_persona"]).default("repo_face"),
|
||||
displayName: z.string().trim().min(1).max(80),
|
||||
repoName: z.string().trim().min(1).optional(),
|
||||
repoPath: z.string().trim().min(1).optional(),
|
||||
|
|
@ -50,7 +51,9 @@ const faceIdentitySchema = z.object({
|
|||
posture: z.string().trim().min(1).optional(),
|
||||
})).default([]),
|
||||
avatarUrl: z.string().trim().url().max(512).optional(),
|
||||
avatarPath: z.string().trim().min(1).optional(),
|
||||
faceStatePath: z.string().trim().min(1).optional(),
|
||||
personaStatePath: z.string().trim().min(1).optional(),
|
||||
description: z.string().trim().min(1).optional(),
|
||||
grants: z.array(agencyGrantSchema).default(["discussion", "rumination", "discord_text"]),
|
||||
jurisdictions: z.array(jurisdictionSchema).default([]),
|
||||
|
|
@ -117,6 +120,7 @@ export function faceToRepoDiscordIdentity(face: ResolvedFaceIdentity): RepoDisco
|
|||
|
||||
return {
|
||||
id: face.id,
|
||||
identityKind: face.identityKind,
|
||||
repoName,
|
||||
displayName: face.displayName,
|
||||
repoPath: face.repoPath,
|
||||
|
|
@ -124,7 +128,9 @@ export function faceToRepoDiscordIdentity(face: ResolvedFaceIdentity): RepoDisco
|
|||
allowedChannelIds: face.allowedChannelIds,
|
||||
channelPermissions: face.channelPermissions,
|
||||
avatarUrl: face.avatarUrl,
|
||||
avatarPath: face.avatarPath,
|
||||
faceStatePath: face.faceStatePath,
|
||||
personaStatePath: face.personaStatePath,
|
||||
description: renderFaceDescription(face),
|
||||
};
|
||||
}
|
||||
|
|
@ -182,10 +188,13 @@ function repoIdentityToEpiphany(identity: RepoDiscordIdentity): EpiphanyIdentity
|
|||
repoName: identity.repoName,
|
||||
repoPath: identity.repoPath,
|
||||
roleId: identity.roleId,
|
||||
identityKind: identity.identityKind,
|
||||
allowedChannelIds: getRepoDiscordIdentityAllowedChannelIds(identity),
|
||||
channelPermissions: identity.channelPermissions,
|
||||
avatarUrl: identity.avatarUrl,
|
||||
avatarPath: identity.avatarPath,
|
||||
faceStatePath: identity.faceStatePath,
|
||||
personaStatePath: identity.personaStatePath,
|
||||
description: identity.description,
|
||||
grants: [
|
||||
"discussion",
|
||||
|
|
@ -233,6 +242,7 @@ function normalizeEpiphanies(epiphanies: EpiphanyIdentity[]): EpiphanyIdentity[]
|
|||
repoName: face.repoName?.trim(),
|
||||
repoPath: face.repoPath?.trim(),
|
||||
roleId: face.roleId?.trim(),
|
||||
identityKind: face.identityKind,
|
||||
allowedChannelIds: [...new Set(face.allowedChannelIds.map((entry) => entry.trim()))],
|
||||
channelPermissions: face.channelPermissions.map((permission) => ({
|
||||
...permission,
|
||||
|
|
@ -242,7 +252,9 @@ function normalizeEpiphanies(epiphanies: EpiphanyIdentity[]): EpiphanyIdentity[]
|
|||
posture: permission.posture?.trim(),
|
||||
})),
|
||||
avatarUrl: face.avatarUrl?.trim(),
|
||||
avatarPath: face.avatarPath?.trim(),
|
||||
faceStatePath: face.faceStatePath?.trim(),
|
||||
personaStatePath: face.personaStatePath?.trim(),
|
||||
description: face.description?.trim(),
|
||||
grants: [...new Set(face.grants)],
|
||||
jurisdictions: face.jurisdictions.map(normalizeJurisdiction),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { z } from "zod";
|
|||
|
||||
const repoDiscordIdentitySchema = z.object({
|
||||
id: z.string().trim().min(1),
|
||||
identityKind: z.enum(["repo_face", "native_persona"]).default("repo_face"),
|
||||
repoName: z.string().trim().min(1),
|
||||
displayName: z.string().trim().min(1).max(80),
|
||||
repoPath: z.string().trim().min(1).optional(),
|
||||
|
|
@ -19,7 +20,9 @@ const repoDiscordIdentitySchema = z.object({
|
|||
posture: z.string().trim().min(1).optional(),
|
||||
})).default([]),
|
||||
avatarUrl: z.string().trim().url().max(512).optional(),
|
||||
avatarPath: z.string().trim().min(1).optional(),
|
||||
faceStatePath: z.string().trim().min(1).optional(),
|
||||
personaStatePath: z.string().trim().min(1).optional(),
|
||||
description: z.string().trim().min(1).optional(),
|
||||
});
|
||||
|
||||
|
|
@ -144,6 +147,10 @@ export function resolveRepoFaceStatePath(
|
|||
return resolve(identity.faceStatePath);
|
||||
}
|
||||
|
||||
if (identity.personaStatePath) {
|
||||
return resolve(identity.personaStatePath);
|
||||
}
|
||||
|
||||
return resolve(storageRoot, "private", "repo-faces", `${sanitizePathSegment(identity.id)}.cc`);
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +206,7 @@ function normalizeRepoDiscordIdentities(
|
|||
return {
|
||||
...identity,
|
||||
id: identity.id.trim(),
|
||||
identityKind: identity.identityKind,
|
||||
repoName: identity.repoName.trim(),
|
||||
displayName: identity.displayName.trim().slice(0, 80),
|
||||
repoPath: identity.repoPath?.trim(),
|
||||
|
|
@ -206,7 +214,9 @@ function normalizeRepoDiscordIdentities(
|
|||
allowedChannelIds: [...new Set(identity.allowedChannelIds.map((entry) => entry.trim()))],
|
||||
channelPermissions: normalizeChannelPermissions(identity.channelPermissions),
|
||||
avatarUrl: identity.avatarUrl?.trim(),
|
||||
avatarPath: identity.avatarPath?.trim(),
|
||||
faceStatePath: identity.faceStatePath?.trim(),
|
||||
personaStatePath: identity.personaStatePath?.trim(),
|
||||
description: identity.description?.trim(),
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export interface RepoFaceInitializationOptions {
|
|||
epiphanyAgentRoot?: string;
|
||||
workspaceRoot?: string;
|
||||
birthMode?: "plan" | "run";
|
||||
birthExecutor?: "codex-exec" | "openai-runtime";
|
||||
birthExecutor?: "model-runtime" | "codex-exec" | "openai-runtime";
|
||||
}
|
||||
|
||||
export interface RepoFaceInitializationResult {
|
||||
|
|
@ -145,7 +145,9 @@ export async function ensureRepoFaceInitialized(
|
|||
"--mode",
|
||||
options.birthMode ?? "plan",
|
||||
"--executor",
|
||||
options.birthExecutor ?? "codex-exec",
|
||||
options.birthExecutor === "codex-exec"
|
||||
? "model-runtime"
|
||||
: options.birthExecutor ?? "model-runtime",
|
||||
],
|
||||
{
|
||||
cwd: options.workspaceRoot ?? process.cwd(),
|
||||
|
|
|
|||
|
|
@ -344,6 +344,43 @@ const faceMoodDimensionSchema = z.object({
|
|||
updatedAt: timestampSchema,
|
||||
}).strict();
|
||||
|
||||
const faceSocialBiasSchema = z.object({
|
||||
name: z.enum([
|
||||
"neuroticism",
|
||||
"threat_sensitivity",
|
||||
"hostile_attribution_bias",
|
||||
"reassurance_need",
|
||||
"grievance_retention",
|
||||
"status_vigilance",
|
||||
"trust_baseline",
|
||||
]),
|
||||
value: z.number().min(0).max(1),
|
||||
summary: z.string().trim().min(1).max(1000),
|
||||
behavioralPull: z.string().trim().min(1).max(1000),
|
||||
updatedAt: timestampSchema,
|
||||
}).strict();
|
||||
|
||||
const faceDoctrineStanceSchema = z.object({
|
||||
stanceId: nonEmptyStringSchema,
|
||||
doctrine: nonEmptyStringSchema,
|
||||
status: z.enum(["active", "cooling", "crystallized", "resolved", "retired"]),
|
||||
target: thoughtTargetSchema,
|
||||
summary: boundedTextSchema,
|
||||
claim: z.string().trim().min(1).max(2000).optional(),
|
||||
question: z.string().trim().min(1).max(2000).optional(),
|
||||
tension: z.string().trim().min(1).max(2000),
|
||||
actionImplication: z.string().trim().min(1).max(2000),
|
||||
intensity: z.number().min(0).max(1).default(0.5),
|
||||
valence: z.number().min(-1).max(1).default(0),
|
||||
anchorRefs: z.array(anchorRefSchema).default([]),
|
||||
evidenceRefs: z.array(evidenceRefSchema).default([]),
|
||||
sourceMemoryIds: z.array(nonEmptyStringSchema).default([]),
|
||||
createdAt: timestampSchema,
|
||||
updatedAt: timestampSchema,
|
||||
retiredAt: timestampSchema.optional(),
|
||||
tags: z.array(nonEmptyStringSchema).default([]),
|
||||
}).strict();
|
||||
|
||||
const selfProfileValueSchema = z.object({
|
||||
id: nonEmptyStringSchema,
|
||||
label: nonEmptyStringSchema,
|
||||
|
|
@ -435,6 +472,8 @@ export const voidFaceAffectSchema = z.object({
|
|||
socialBonds: z.array(faceSocialBondSchema).default([]),
|
||||
statusReads: z.array(faceStatusReadSchema).default([]),
|
||||
moodDimensions: z.array(faceMoodDimensionSchema).default([]),
|
||||
socialBiases: z.array(faceSocialBiasSchema).default([]),
|
||||
doctrineStances: z.array(faceDoctrineStanceSchema).default([]),
|
||||
updatedAt: timestampSchema,
|
||||
}).strict();
|
||||
|
||||
|
|
@ -626,6 +665,21 @@ export const voidSelfStateOperationSchema = z.discriminatedUnion("operation", [
|
|||
dimensions: z.array(faceMoodDimensionSchema).min(1),
|
||||
updatedAt: timestampSchema,
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("update_social_biases"),
|
||||
biases: z.array(faceSocialBiasSchema).min(1),
|
||||
updatedAt: timestampSchema,
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("upsert_doctrine_stance"),
|
||||
stance: faceDoctrineStanceSchema,
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("retire_doctrine_stance"),
|
||||
stanceId: nonEmptyStringSchema,
|
||||
retiredAt: timestampSchema,
|
||||
reason: z.string().trim().min(1).max(1000),
|
||||
}).strict(),
|
||||
z.object({
|
||||
operation: z.literal("update_sleep_cycle"),
|
||||
sleepCycle: voidScheduledRuntimeSchema.shape.sleepCycle,
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ export function createEmptyVoidSelfState(
|
|||
socialBonds: [],
|
||||
statusReads: [],
|
||||
moodDimensions: [],
|
||||
socialBiases: [],
|
||||
doctrineStances: [],
|
||||
updatedAt: createdAt,
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ function pruneRetiredTypedState(state: VoidSelfStateTypedProjection): void {
|
|||
state.faceAffect.needs = state.faceAffect.needs.filter(isNotRetiredEntry);
|
||||
state.faceAffect.socialBonds = state.faceAffect.socialBonds.filter(isNotRetiredEntry);
|
||||
state.faceAffect.statusReads = state.faceAffect.statusReads.filter(isNotRetiredEntry);
|
||||
state.faceAffect.doctrineStances = state.faceAffect.doctrineStances.filter(isNotRetiredEntry);
|
||||
}
|
||||
|
||||
function isNotRetiredEntry(entry: { status?: string; retiredAt?: string }): boolean {
|
||||
|
|
@ -434,6 +435,25 @@ function applyTypedOperation(
|
|||
.slice(0, 32);
|
||||
state.faceAffect.updatedAt = operation.updatedAt;
|
||||
return;
|
||||
case "update_social_biases":
|
||||
for (const bias of operation.biases) {
|
||||
upsertBy(state.faceAffect.socialBiases, bias, (entry) => entry.name);
|
||||
}
|
||||
state.faceAffect.socialBiases = state.faceAffect.socialBiases
|
||||
.sort((left, right) => right.value - left.value)
|
||||
.slice(0, 24);
|
||||
state.faceAffect.updatedAt = operation.updatedAt;
|
||||
return;
|
||||
case "upsert_doctrine_stance":
|
||||
upsertBy(state.faceAffect.doctrineStances, operation.stance, (entry) => entry.stanceId);
|
||||
state.faceAffect.doctrineStances = state.faceAffect.doctrineStances
|
||||
.sort((left, right) => right.intensity - left.intensity)
|
||||
.slice(0, 48);
|
||||
state.faceAffect.updatedAt = operation.stance.updatedAt;
|
||||
return;
|
||||
case "retire_doctrine_stance":
|
||||
retireDoctrineStance(state.faceAffect, operation);
|
||||
return;
|
||||
case "update_sleep_cycle":
|
||||
state.scheduledRuntime.sleepCycle = operation.sleepCycle;
|
||||
state.scheduledRuntime.updatedAt = new Date().toISOString();
|
||||
|
|
@ -688,6 +708,20 @@ function retireStatusRead(
|
|||
faceAffect.updatedAt = operation.retiredAt;
|
||||
}
|
||||
|
||||
function retireDoctrineStance(
|
||||
faceAffect: VoidFaceAffect,
|
||||
operation: Extract<VoidSelfStateOperation, { operation: "retire_doctrine_stance" }>,
|
||||
): void {
|
||||
const stance = faceAffect.doctrineStances.find((entry) => entry.stanceId === operation.stanceId);
|
||||
if (stance) {
|
||||
stance.status = "retired";
|
||||
stance.retiredAt = operation.retiredAt;
|
||||
stance.updatedAt = operation.retiredAt;
|
||||
stance.tags = Array.from(new Set([...stance.tags, `retired:${operation.reason}`]));
|
||||
}
|
||||
faceAffect.updatedAt = operation.retiredAt;
|
||||
}
|
||||
|
||||
function closeCasesForReceipt(
|
||||
cursor: VoidModerationCursor,
|
||||
receipt: VoidSpeechReceipts["recentReceipts"][number],
|
||||
|
|
|
|||
Loading…
Reference in a new issue