Delete Epiphany Discord operator ingress

This commit is contained in:
Meta Vens 2026-08-22 06:16:39 +02:00
commit 78763ea308
15 changed files with 0 additions and 1595 deletions

View file

@ -1,593 +0,0 @@
import assert from "node:assert/strict";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { createRequire } from "node:module";
import { join, resolve } from "node:path";
import { buildEpiphanyOperatorRequest, epiphanyOperatorRequestPayloadSha256, processEpiphanyOperatorDelivery, consumeEpiphanyOperatorDeliveries, registerEpiphanyOperatorInteraction, submitEpiphanyOperatorRequest, validateDelivery, type EpiphanyOperatorDeliveryDocument, type EpiphanyOperatorDeliveryCheckpoint } from "../packages/core/src/index";
async function main(): Promise<void> {
const request = buildEpiphanyOperatorRequest(
{
interactionId: "interaction-1",
actorDiscordId: "owner-1",
guildId: "guild-1",
channelId: "channel-1",
command: { kind: "sleep", reason: "bank the fire" },
issuedAt: "2026-07-19T12:00:00.000Z",
},
"voidbot-yggdrasil",
);
const digest = epiphanyOperatorRequestPayloadSha256(request);
assert.match(digest, /^sha256-[0-9a-f]{64}$/);
assert.notEqual(
digest,
epiphanyOperatorRequestPayloadSha256({
...request,
discordGuildId: "other",
}),
);
assert.notEqual(
digest,
epiphanyOperatorRequestPayloadSha256({
...request,
command: { kind: "wake" },
}),
);
const completed: EpiphanyOperatorDeliveryDocument = {
schemaVersion: "bifrost.discord.epiphany_operator_delivery.v1",
deliveryId: request.requestId,
requestId: request.requestId,
requestPayloadSha256: digest,
commandId: request.commandId,
discordGuildId: request.discordGuildId,
discordChannelId: request.discordChannelId,
discordInteractionId: request.sourceEventId,
targetRuntimeId: "epiphany-yggdrasil",
status: "completed",
disposition: "observed",
failureCode: "",
detail: "sleep accepted",
operatorStatus: "sleeping",
stateStatus: "banked",
coordinatorAction: "none",
brakeStatus: "engaged",
sealedResultPayloadSha256: `sha256-${"a".repeat(64)}`,
executorSignatureSha256: `sha256-${"b".repeat(64)}`,
resultProviderIdentityId: "bifrost-yggdrasil",
reviews: [],
reviewCandidateId: "",
reviewDecision: "",
statusV2: null,
recordedAt: "2026-07-19T12:00:01.000Z",
privateStateExposed: false,
};
assert.equal(validateDelivery(completed).status, "completed");
const refused: EpiphanyOperatorDeliveryDocument = {
...completed,
status: "refused",
disposition: "",
failureCode: "brakes_engaged",
detail: "refused",
operatorStatus: "",
stateStatus: "",
coordinatorAction: "",
brakeStatus: "",
sealedResultPayloadSha256: "",
executorSignatureSha256: "",
resultProviderIdentityId: "",
reviews: [],
reviewCandidateId: "",
reviewDecision: "",
};
assert.equal(validateDelivery(refused).status, "refused");
function rejects(change: Record<string, unknown>, pattern: RegExp): void {
assert.throws(() => validateDelivery({ ...completed, ...change }), pattern);
}
rejects({ privateStateExposed: true }, /private state/);
rejects({ status: "pending" }, /terminal/);
rejects({ detail: "x".repeat(513) }, /detail/);
rejects({ operatorStatus: "x".repeat(513) }, /operatorStatus/);
rejects({ requestPayloadSha256: "raw-payload" }, /digest/);
rejects({ targetRuntimeId: "epiphany-nightwing" }, /runtime/);
rejects({ deliveryId: "collision" }, /identity/);
rejects({ executorSignatureSha256: "signature-bytes" }, /sealed bindings/);
rejects({ resultProviderIdentityId: "" }, /resultProviderIdentityId|sealed bindings/);
rejects({ surprisePrivatePayload: "secret" }, /field set/);
rejects(
{
reviews: [
{
mindRequestId: "m",
candidateId: "c",
candidateSha256: "1".repeat(64),
modelRevision: 1,
modelHash: "2".repeat(64),
frontierItemId: "f",
requestedAt: "2026-07-19T12:00:00Z",
proposalText: "private",
},
],
},
/inexact field set/,
);
rejects(
{
reviews: Array.from({ length: 11 }, () => ({
mindRequestId: "m",
candidateId: "c",
candidateSha256: "1".repeat(64),
modelRevision: 1,
modelHash: "2".repeat(64),
frontierItemId: "f",
requestedAt: "2026-07-19T12:00:00Z",
})),
},
/at most ten/,
);
assert.throws(() => validateDelivery({ ...refused, brakeStatus: "not empty" }), /completed-result bindings/);
assert.throws(() => validateDelivery({ ...refused, failureCode: "" }), /failureCode|failure code/);
const baseCheckpoint: EpiphanyOperatorDeliveryCheckpoint = {
schemaVersion: "voidbot.private.epiphany_operator_delivery_checkpoint.v0",
requestId: request.requestId,
applicationId: "app-1",
interactionToken: "private-token",
discordGuildId: request.discordGuildId,
discordChannelId: request.discordChannelId,
discordInteractionId: request.sourceEventId,
targetRuntimeId: "epiphany-yggdrasil",
state: "pending",
observedDeliverySha256: "",
respondedDeliverySha256: "",
attemptCount: 0,
lastError: "",
registeredAt: "2026-07-19T12:00:00.000Z",
updatedAt: "2026-07-19T12:00:00.000Z",
};
const statusRequest = buildEpiphanyOperatorRequest(
{
interactionId: "interaction-status",
actorDiscordId: "owner-1",
guildId: "guild-1",
channelId: "channel-1",
command: { kind: "status" },
issuedAt: "2026-07-19T12:00:00.000Z",
},
"voidbot-yggdrasil",
);
const unavailable = (daemonId: string, healthContract: string) => ({
daemonId,
healthContract,
availability: "unavailable" as const,
unavailableReason: "required-provider-record-missing",
state: null,
reasonCode: null,
providerObservedAtUnixMillis: null,
evaluatedAtUnixMillis: null,
expiresAtUnixMillis: null,
releaseId: null,
releaseWitnessSha256: null,
sourceCommit: null,
deploymentId: null,
projectionSha256: null,
});
const statusDelivery: EpiphanyOperatorDeliveryDocument = {
...completed,
deliveryId: statusRequest.requestId,
requestId: statusRequest.requestId,
commandId: statusRequest.commandId,
discordInteractionId: statusRequest.sourceEventId,
requestPayloadSha256: epiphanyOperatorRequestPayloadSha256(statusRequest),
statusV2: {
schemaVersion: "epiphany.operator.status.v2",
releaseId: "release-7",
releaseWitnessSha256: `sha256-${"7".repeat(64)}`,
sourceCommit: "8".repeat(40),
deploymentId: "deployment-9",
coordinatorSnapshot: "sleeping",
coordinatorState: "ready",
coordinatorAction: "none",
brakeStatus: "engaged",
residentStatus: "idle",
pressureCount: 3,
pendingReviewCount: 2,
providerSetStatus: "incomplete",
providers: [unavailable("yggdrasil-epiphany", "epiphany.cultnet-rudp-runtime-health"), unavailable("yggdrasil-bifrost-persona-feedback", "bifrost.cultnet-rudp-persona-feedback-health")],
privateStateExposed: false,
},
};
assert.equal(validateDelivery(statusDelivery).statusV2?.providerSetStatus, "incomplete");
for (const hostile of [
{
...statusDelivery,
statusV2: { ...statusDelivery.statusV2!, privateKey: "secret" },
},
{
...statusDelivery,
statusV2: { ...statusDelivery.statusV2!, privateStateExposed: true },
},
{
...statusDelivery,
statusV2: {
...statusDelivery.statusV2!,
residentStatus: "x".repeat(257),
},
},
{
...statusDelivery,
statusV2: {
...statusDelivery.statusV2!,
providerSetStatus: "complete-authenticated",
},
},
{
...statusDelivery,
statusV2: {
...statusDelivery.statusV2!,
providers: [...statusDelivery.statusV2!.providers].reverse(),
},
},
])
assert.throws(() => validateDelivery(hostile));
let statusText = "",
statusCheckpoint = {
...baseCheckpoint,
requestId: statusRequest.requestId,
discordInteractionId: statusRequest.sourceEventId,
};
assert.equal(
await processEpiphanyOperatorDelivery(
statusDelivery,
statusRequest,
statusCheckpoint,
async (_a, _t, text) => {
statusText = text;
},
async (next) => {
statusCheckpoint = next;
},
),
"responded",
);
assert.match(statusText, /Deployment: release-7 \| commit [8]{40} \| deployment-9/);
assert.match(statusText, /Resident: idle \| Brake: engaged/);
assert.match(statusText, /Pressure: 3 \| Reviews: 2/);
assert.match(statusText, /Provider set: incomplete/);
assert.match(statusText, /Epiphany: unavailable \(required-provider-record-missing\)/);
assert.match(statusText, /Bifrost: unavailable \(required-provider-record-missing\)/);
assert.doesNotMatch(statusText, /signature|sha256|private|path|key/i);
assert.ok(statusText.length < 2000);
const currentProvider = (base: ReturnType<typeof unavailable>, state: string, withLineage: boolean) => ({
...base,
availability: "authenticated-current" as const,
unavailableReason: "",
state,
reasonCode: "healthy",
providerObservedAtUnixMillis: 1,
evaluatedAtUnixMillis: 2,
expiresAtUnixMillis: 3,
releaseId: withLineage ? "release-7" : null,
releaseWitnessSha256: withLineage ? `sha256-${"7".repeat(64)}` : null,
sourceCommit: withLineage ? "8".repeat(40) : null,
deploymentId: withLineage ? "deployment-9" : null,
projectionSha256: `sha256-${"9".repeat(64)}`,
});
const completeDelivery: EpiphanyOperatorDeliveryDocument = {
...statusDelivery,
statusV2: {
...statusDelivery.statusV2!,
providerSetStatus: "complete-authenticated",
providers: [currentProvider(unavailable("yggdrasil-epiphany", "epiphany.cultnet-rudp-runtime-health"), "serving", true), currentProvider(unavailable("yggdrasil-bifrost-persona-feedback", "bifrost.cultnet-rudp-persona-feedback-health"), "ready", false)],
},
};
let completeText = "",
completeCheckpoint = {
...baseCheckpoint,
requestId: statusRequest.requestId,
discordInteractionId: statusRequest.sourceEventId,
};
assert.equal(
await processEpiphanyOperatorDelivery(
completeDelivery,
statusRequest,
completeCheckpoint,
async (_a, _t, text) => {
completeText = text;
},
async (next) => {
completeCheckpoint = next;
},
),
"responded",
);
assert.match(completeText, /Provider set: complete-authenticated/);
assert.match(completeText, /Epiphany: authenticated-current \| serving \| healthy/);
assert.match(completeText, /Bifrost: authenticated-current \| ready \| healthy/);
assert.doesNotMatch(completeText, /sha256|signature|private|path|key/i);
assert.equal(
await processEpiphanyOperatorDelivery(
{ ...statusDelivery, statusV2: null },
statusRequest,
{
...baseCheckpoint,
requestId: statusRequest.requestId,
discordInteractionId: statusRequest.sourceEventId,
},
async () => {
throw new Error("must not lower missing status");
},
async () => {},
),
"failed",
);
let current = baseCheckpoint;
let editCount = 0;
let failEdit = true;
const edit = async (_app: string, token: string, content: string): Promise<void> => {
assert.equal(token, "private-token");
assert.doesNotMatch(content, /signature|private-token|sha256-/i);
editCount += 1;
if (failEdit) throw new Error("temporary Discord failure");
};
const save = async (next: EpiphanyOperatorDeliveryCheckpoint): Promise<void> => {
current = next;
};
assert.equal(await processEpiphanyOperatorDelivery(completed, request, current, edit, save), "failed");
assert.equal(current.state, "pending");
assert.match(current.lastError, /temporary Discord failure/);
assert.ok(current.observedDeliverySha256);
failEdit = false;
assert.equal(await processEpiphanyOperatorDelivery(completed, request, current, edit, save), "responded");
assert.equal(current.state, "responded");
assert.equal(await processEpiphanyOperatorDelivery(completed, request, current, edit, save), "replayed");
assert.equal(editCount, 2, "a restart replay must not create another response");
for (const [field, value] of [
["commandId", "wrong"],
["discordGuildId", "wrong"],
["discordChannelId", "wrong"],
["discordInteractionId", "wrong"],
["targetRuntimeId", "epiphany-nightwing"],
["requestPayloadSha256", `sha256-${"c".repeat(64)}`],
] as const) {
let rejectedCheckpoint = { ...baseCheckpoint };
assert.equal(
await processEpiphanyOperatorDelivery(
{ ...completed, [field]: value },
request,
rejectedCheckpoint,
async () => {
throw new Error("must not edit");
},
async (next) => {
rejectedCheckpoint = next;
},
),
"failed",
);
assert.match(rejectedCheckpoint.lastError, /request|runtime|digest/);
}
let collisionCheckpoint = {
...baseCheckpoint,
observedDeliverySha256: `sha256-${"d".repeat(64)}`,
};
assert.equal(
await processEpiphanyOperatorDelivery(
completed,
request,
collisionCheckpoint,
async () => {
throw new Error("must not edit");
},
async (next) => {
collisionCheckpoint = next;
},
),
"failed",
);
assert.match(collisionCheckpoint.lastError, /collision/);
const reviewRequest = buildEpiphanyOperatorRequest(
{
interactionId: "interaction-review",
actorDiscordId: "owner-1",
guildId: "guild-1",
channelId: "channel-1",
command: { kind: "reviews" },
issuedAt: "2026-07-19T12:00:00.000Z",
},
"voidbot-yggdrasil",
);
const reviewDelivery: EpiphanyOperatorDeliveryDocument = {
...completed,
deliveryId: reviewRequest.requestId,
requestId: reviewRequest.requestId,
commandId: reviewRequest.commandId,
discordInteractionId: reviewRequest.sourceEventId,
requestPayloadSha256: epiphanyOperatorRequestPayloadSha256(reviewRequest),
reviews: [
{
mindRequestId: "mind-1",
candidateId: "candidate-1",
candidateSha256: "1".repeat(64),
modelRevision: 7,
modelHash: "2".repeat(64),
frontierItemId: "frontier-1",
requestedAt: "2026-07-19T11:59:00Z",
},
],
};
let renderedReview = "";
let reviewCheckpoint = {
...baseCheckpoint,
requestId: reviewRequest.requestId,
discordInteractionId: reviewRequest.sourceEventId,
};
assert.equal(
await processEpiphanyOperatorDelivery(
reviewDelivery,
reviewRequest,
reviewCheckpoint,
async (_app, _token, content) => {
renderedReview = content;
},
async (next) => {
reviewCheckpoint = next;
},
),
"responded",
);
assert.match(renderedReview, /candidate-1.*request mind-1.*revision 7.*frontier frontier-1/);
assert.doesNotMatch(renderedReview, /proposal|private|sha256/i);
let substitutedCheckpoint = { ...baseCheckpoint };
assert.equal(
await processEpiphanyOperatorDelivery(
{ ...completed, reviews: reviewDelivery.reviews },
request,
substitutedCheckpoint,
async () => {
throw new Error("must not render substituted review state");
},
async (next) => {
substitutedCheckpoint = next;
},
),
"failed",
);
assert.match(substitutedCheckpoint.lastError, /non-review/);
const decisionRequest = buildEpiphanyOperatorRequest(
{
interactionId: "interaction-decision",
actorDiscordId: "owner-1",
guildId: "guild-1",
channelId: "channel-1",
command: {
kind: "review",
mindRequestId: "mind-1",
candidateId: "candidate-1",
candidateSha256: "1".repeat(64),
expectedModelRevision: 7,
expectedModelHash: "2".repeat(64),
decision: "hold",
},
issuedAt: "2026-07-19T12:00:00.000Z",
},
"voidbot-yggdrasil",
);
const decisionDelivery: EpiphanyOperatorDeliveryDocument = {
...completed,
deliveryId: decisionRequest.requestId,
requestId: decisionRequest.requestId,
commandId: decisionRequest.commandId,
discordInteractionId: decisionRequest.sourceEventId,
requestPayloadSha256: epiphanyOperatorRequestPayloadSha256(decisionRequest),
reviewCandidateId: "candidate-1",
reviewDecision: "hold",
};
let decisionCheckpoint = {
...baseCheckpoint,
requestId: decisionRequest.requestId,
discordInteractionId: decisionRequest.sourceEventId,
};
assert.equal(
await processEpiphanyOperatorDelivery(
{ ...decisionDelivery, reviewCandidateId: "candidate-2" },
decisionRequest,
decisionCheckpoint,
async () => {
throw new Error("must not render substituted decision");
},
async (next) => {
decisionCheckpoint = next;
},
),
"failed",
);
assert.match(decisionCheckpoint.lastError, /exact candidate and decision/);
const temp = await mkdtemp(join(tmpdir(), "voidbot-epiphany-delivery-"));
try {
const bifrostRoot = resolve("../Bifrost");
const cultlibRoot = resolve("../CultLib");
const stores = {
requestStorePath: join(temp, "requests.cc"),
deliveryStorePath: join(temp, "deliveries.cc"),
checkpointStorePath: join(temp, "checkpoints.cc"),
bifrostRoot,
cultlibRoot,
};
await registerEpiphanyOperatorInteraction(
{
requestId: request.requestId,
applicationId: "app-1",
interactionToken: "private-token",
guildId: request.discordGuildId,
channelId: request.discordChannelId,
registeredAt: request.issuedAt,
},
stores,
);
await submitEpiphanyOperatorRequest(
{
interactionId: request.requestId,
actorDiscordId: request.sourceActorDiscordId,
guildId: request.discordGuildId,
channelId: request.discordChannelId,
command: request.command,
issuedAt: request.issuedAt,
},
{
storePath: stores.requestStorePath,
bifrostRoot,
cultlibRoot,
producerRuntimeId: request.producerRuntimeId,
},
);
const cachePackage = resolve(cultlibRoot, "packages/cultcache-ts/package.json");
const meshPackage = resolve(cultlibRoot, "packages/cultmesh-ts/package.json");
const define = createRequire(cachePackage)("cultcache-ts").defineDocumentType;
const CultMesh = createRequire(meshPackage)("cultmesh-ts").CultMesh;
const deliveryDef = define({
type: "bifrost.discord.epiphany_operator_delivery",
schemaName: "bifrost.discord.epiphany_operator_delivery",
schemaId: completed.schemaVersion,
schemaVersion: completed.schemaVersion,
contentHash: completed.schemaVersion,
global: false,
name: "deliveryId",
schema: { parse: (value: unknown) => value },
});
const deliveryNode = await CultMesh.createNode(stores.deliveryStorePath, {
documents: [deliveryDef],
});
await deliveryNode.put(deliveryDef, completed.deliveryId, completed);
let integrationEdits = 0;
assert.deepEqual(
await consumeEpiphanyOperatorDeliveries(stores, async () => {
integrationEdits += 1;
}),
{ observed: 1, responded: 1, failed: 0 },
);
assert.deepEqual(
await consumeEpiphanyOperatorDeliveries(stores, async () => {
integrationEdits += 1;
}),
{ observed: 1, responded: 0, failed: 0 },
);
assert.equal(integrationEdits, 1);
} finally {
await rm(temp, { recursive: true, force: true });
}
console.log("Epiphany operator delivery smoke passed.");
}
void main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

View file

@ -1,122 +0,0 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
import {
EPIPHANY_OPERATOR_REQUEST_SCHEMA,
EPIPHANY_OPERATOR_REQUEST_TYPE,
buildEpiphanyOperatorRequest,
submitEpiphanyOperatorRequest,
} from "../packages/core/src/epiphany-operator-request";
import { commandDefinitions, isExactDiscordOwner } from "../apps/bot/src/discord-bot-handlers";
async function main(): Promise<void> {
const owner = "owner-1";
assert.equal(isExactDiscordOwner(owner, owner), true);
assert.equal(isExactDiscordOwner("administrator-1", owner), false);
assert.equal(isExactDiscordOwner("tier-one-1", owner), false);
const epiphany = commandDefinitions.map((command) => command.toJSON()).find((command) => command.name === "epiphany");
assert.ok(epiphany, "slash command is registered");
assert.deepEqual(epiphany.options?.map((option) => option.name), ["status", "sleep", "wake", "direct", "reviews", "review"]);
const protocolPath = process.env.EPIPHANY_OPERATOR_PROTOCOL_FIXTURE
?? resolve("..", "EpiphanyAgent", ".epiphany-smoke", "operator-command-interop-rust", "protocol.json");
const protocol = JSON.parse(await readFile(protocolPath, "utf8"));
assert.equal(protocol.schemaVersion, "epiphany.operator_command.protocol_fixture.v1");
assert.equal(protocol.admissionSchemaVersion, "bifrost.operator_command.delivery.v1");
assert.equal(protocol.resultSchemaVersion, "epiphany.operator_command.result.v1");
assert.deepEqual(protocol.commands.map((command: { kind: string }) => command.kind), ["status", "sleep", "wake", "directive", "reviews", "review"]);
assert.deepEqual(protocol.reviewDecisions, ["adopt", "refuse", "hold"]);
const issuedAt = "2026-07-19T12:00:00.000Z";
const commands = [
{ kind: "status" } as const,
{ kind: "sleep", reason: "Operator is packing the workstation." } as const,
{ kind: "wake" } as const,
{ kind: "directive", objective: "Inspect the current domain map and propose the next bounded improvement." } as const,
{ kind: "reviews" } as const,
protocol.commands[5],
];
for (const [index, command] of commands.entries()) {
const id = `interaction-${index}`;
const request = buildEpiphanyOperatorRequest({
interactionId: id,
actorDiscordId: owner,
guildId: "guild-1",
channelId: "channel-1",
command,
issuedAt,
}, "voidbot-yggdrasil");
assert.equal(request.schemaName, EPIPHANY_OPERATOR_REQUEST_TYPE);
assert.equal(request.schemaVersion, EPIPHANY_OPERATOR_REQUEST_SCHEMA);
assert.equal(request.requestId, id);
assert.equal(request.commandId, id);
assert.equal(request.nonce, id);
assert.equal(request.sourceEventId, id);
assert.equal(request.discordMessageId, id);
assert.equal(request.targetRuntimeId, "epiphany-yggdrasil");
assert.equal(request.authorityClass, "operator_request_only");
assert.equal(Date.parse(request.expiresAt) - Date.parse(request.issuedAt), 60_000);
assert.deepEqual(Object.keys(request).sort(), [
"authorityClass", "command", "commandId", "discordChannelId", "discordGuildId",
"discordMessageId", "expiresAt", "issuedAt", "nonce", "producerId", "producerRuntimeId",
"requestId", "schemaName", "schemaVersion", "sourceActorDiscordId", "sourceEventId", "status",
"targetRuntimeId",
].sort());
}
const stored = new Map<string, unknown>();
const definition = {};
const openNode = async () => ({
get: (_definition: unknown, key: string) => stored.get(key),
put: async (_definition: unknown, key: string, value: unknown) => { stored.set(key, value); },
flush: async () => undefined,
cache: { pullAllBackingStores: async () => undefined },
});
const input = {
interactionId: "interaction-replay",
actorDiscordId: owner,
guildId: "guild-1",
channelId: "channel-1",
command: { kind: "wake" } as const,
issuedAt,
};
const config = { storePath: "unused.cc", bifrostRoot: "unused", producerRuntimeId: "voidbot-yggdrasil" };
await submitEpiphanyOperatorRequest(input, config, { definition, openNode });
await submitEpiphanyOperatorRequest(input, config, { definition, openNode });
await assert.rejects(
submitEpiphanyOperatorRequest({ ...input, command: { kind: "status" } }, config, { definition, openNode }),
/different immutable content/,
);
assert.throws(() => buildEpiphanyOperatorRequest({ ...input, command: { kind: "sleep", reason: "x".repeat(501) } }, "voidbot-yggdrasil"), /500/);
assert.throws(() => buildEpiphanyOperatorRequest({ ...input, command: { kind: "directive", objective: "x".repeat(2001) } }, "voidbot-yggdrasil"), /2000/);
const review = commands[5] as Extract<(typeof commands)[number], { kind: "review" }>;
assert.deepEqual(Object.keys(protocol.commands[5]).sort(), ["candidateId", "candidateSha256", "decision", "expectedModelHash", "expectedModelRevision", "kind", "mindRequestId"].sort());
assert.throws(() => buildEpiphanyOperatorRequest({ ...input, command: { ...review, candidateSha256: "0".repeat(63) } }, "voidbot-yggdrasil"), /64 lowercase/);
assert.throws(() => buildEpiphanyOperatorRequest({ ...input, command: { ...review, expectedModelRevision: -1 } }, "voidbot-yggdrasil"), /non-negative/);
assert.throws(() => buildEpiphanyOperatorRequest({ ...input, command: { ...review, decision: "approve" as "adopt" } }, "voidbot-yggdrasil"), /decision/);
const botSource = await readFile(resolve("apps/bot/src/discord-bot.ts"), "utf8");
const messageCreate = botSource.slice(botSource.indexOf("client.on(Events.MessageCreate"), botSource.indexOf("client.on(Events.MessageUpdate"));
assert.ok(messageCreate.includes("exportPersonaFeedbackWithRetry"), "ordinary addressed messages retain feedback export");
assert.ok(!messageCreate.includes("submitEpiphanyOperatorRequest"), "ordinary messages cannot submit operator requests");
console.log(JSON.stringify({
schemaVersion: EPIPHANY_OPERATOR_REQUEST_SCHEMA,
commands: ["status", "sleep", "wake", "direct", "reviews", "review"],
rustProtocolFixtureConsumed: true,
exactOwnerOnly: true,
ordinaryMessagesRemainFeedbackOnly: true,
localExecutionAuthorized: false,
mindAuthorityGranted: false,
handsAuthorityGranted: false,
releaseAuthorityGranted: false,
deploymentAuthorityGranted: false,
}, null, 2));
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});