Delete Epiphany Discord operator ingress
This commit is contained in:
parent
1f2f4f0c02
commit
78763ea308
15 changed files with 0 additions and 1595 deletions
|
|
@ -11,7 +11,6 @@ import {
|
|||
import type { AppConfig } from "@voidbot/config";
|
||||
import {
|
||||
ContextBuilder,
|
||||
type EpiphanyOperatorCommand,
|
||||
type OllamaSituationalSocialReadInferer,
|
||||
loadVoidSelfState,
|
||||
PermissionEngine,
|
||||
|
|
@ -123,89 +122,8 @@ export const commandDefinitions = [
|
|||
new SlashCommandBuilder()
|
||||
.setName("set-style")
|
||||
.setDescription("Reload the configured style pack from disk."),
|
||||
new SlashCommandBuilder()
|
||||
.setName("epiphany")
|
||||
.setDescription("Request an operator action from the Yggdrasil Epiphany runtime.")
|
||||
.addSubcommand((command) =>
|
||||
command.setName("status").setDescription("Request a sealed operator status receipt."),
|
||||
)
|
||||
.addSubcommand((command) =>
|
||||
command
|
||||
.setName("sleep")
|
||||
.setDescription("Request that Epiphany engage its swarm brake.")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("Why the swarm should sleep.")
|
||||
.setRequired(true)
|
||||
.setMaxLength(500),
|
||||
),
|
||||
)
|
||||
.addSubcommand((command) =>
|
||||
command.setName("wake").setDescription("Request that Epiphany release its swarm brake."),
|
||||
)
|
||||
.addSubcommand((command) =>
|
||||
command
|
||||
.setName("direct")
|
||||
.setDescription("Submit bounded operator pressure to resident Self.")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("objective")
|
||||
.setDescription("The objective to consider; this grants no consequence authority.")
|
||||
.setRequired(true)
|
||||
.setMaxLength(2000),
|
||||
),
|
||||
)
|
||||
.addSubcommand((command) =>
|
||||
command.setName("reviews").setDescription("List bounded identities of current Mind review candidates."),
|
||||
)
|
||||
.addSubcommand((command) =>
|
||||
command
|
||||
.setName("review")
|
||||
.setDescription("Commit a disposition for one exact current Mind candidate.")
|
||||
.addStringOption((option) => option.setName("mind-request-id").setDescription("Exact Mind request identity.").setRequired(true).setMaxLength(256))
|
||||
.addStringOption((option) => option.setName("candidate-id").setDescription("Exact candidate identity.").setRequired(true).setMaxLength(256))
|
||||
.addStringOption((option) => option.setName("candidate-sha256").setDescription("Exact candidate SHA-256 hex digest.").setRequired(true).setMinLength(64).setMaxLength(64))
|
||||
.addIntegerOption((option) => option.setName("model-revision").setDescription("Expected canonical model revision.").setRequired(true).setMinValue(0))
|
||||
.addStringOption((option) => option.setName("model-hash").setDescription("Expected canonical model SHA-256 hex hash.").setRequired(true).setMinLength(64).setMaxLength(64))
|
||||
.addStringOption((option) => option.setName("decision").setDescription("Mind disposition.").setRequired(true)
|
||||
.addChoices({ name: "Adopt", value: "adopt" }, { name: "Refuse", value: "refuse" }, { name: "Hold", value: "hold" })),
|
||||
),
|
||||
];
|
||||
|
||||
export function epiphanyOperatorCommandFromInteraction(
|
||||
interaction: ChatInputCommandInteraction<CacheType>,
|
||||
): EpiphanyOperatorCommand {
|
||||
switch (interaction.options.getSubcommand(true)) {
|
||||
case "status":
|
||||
return { kind: "status" };
|
||||
case "sleep":
|
||||
return { kind: "sleep", reason: interaction.options.getString("reason", true) };
|
||||
case "wake":
|
||||
return { kind: "wake" };
|
||||
case "direct":
|
||||
return { kind: "directive", objective: interaction.options.getString("objective", true) };
|
||||
case "reviews":
|
||||
return { kind: "reviews" };
|
||||
case "review":
|
||||
return {
|
||||
kind: "review",
|
||||
mindRequestId: interaction.options.getString("mind-request-id", true),
|
||||
candidateId: interaction.options.getString("candidate-id", true),
|
||||
candidateSha256: interaction.options.getString("candidate-sha256", true),
|
||||
expectedModelRevision: interaction.options.getInteger("model-revision", true),
|
||||
expectedModelHash: interaction.options.getString("model-hash", true),
|
||||
decision: interaction.options.getString("decision", true) as "adopt" | "refuse" | "hold",
|
||||
};
|
||||
default:
|
||||
throw new Error("Unsupported Epiphany operator subcommand.");
|
||||
}
|
||||
}
|
||||
|
||||
export function isExactDiscordOwner(actorId: string, ownerDiscordId: string): boolean {
|
||||
return actorId === ownerDiscordId;
|
||||
}
|
||||
|
||||
export interface PromptHandlerOptions {
|
||||
prompt: string;
|
||||
command: CommandName;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import {
|
|||
loadFaceIdentityRegistry,
|
||||
queueRepoFaceMention,
|
||||
exportPersonaFeedbackObservation,
|
||||
registerEpiphanyOperatorInteraction,
|
||||
submitEpiphanyOperatorRequest,
|
||||
type RepoDiscordIdentity,
|
||||
stripRepoIdentityTextAddress,
|
||||
loadStylePack,
|
||||
|
|
@ -59,15 +57,12 @@ import {
|
|||
handleReindexChannel,
|
||||
handleSearchHistory,
|
||||
handleSummarizeChannel,
|
||||
epiphanyOperatorCommandFromInteraction,
|
||||
isExactDiscordOwner,
|
||||
maybeRegisterCommands,
|
||||
parseProviderOverride,
|
||||
replyEphemeral,
|
||||
} from "./discord-bot-handlers";
|
||||
import { maybeMirrorOwnerAquariumMessageAsMetameVoice } from "./metame-owner-voice-bridge";
|
||||
import { startRepoFaceVoicePlayback } from "./repo-face-voice-playback";
|
||||
import { startEpiphanyOperatorDeliveryConsumer } from "./epiphany-operator-delivery-consumer";
|
||||
import {
|
||||
buildActorFromInteraction,
|
||||
buildActorFromMessage,
|
||||
|
|
@ -344,15 +339,6 @@ export async function startBot(): Promise<void> {
|
|||
console.log(`VoidBot connected as ${readyClient.user.tag}.`);
|
||||
await maybeRegisterCommands(config.botToken!, config.applicationId, config.developmentGuildId);
|
||||
startRepoFaceVoicePlayback(readyClient, config.repoFaceDiscordVoice);
|
||||
startEpiphanyOperatorDeliveryConsumer({
|
||||
applicationId: readyClient.application.id,
|
||||
requestStorePath: config.bifrostEpiphanyOperatorRequestStorePath,
|
||||
deliveryStorePath: config.bifrostEpiphanyOperatorDeliveryStorePath,
|
||||
checkpointStorePath: config.epiphanyOperatorDeliveryCheckpointStorePath,
|
||||
bifrostRoot: config.bifrostRoot,
|
||||
cultlibRoot: process.env.VOIDBOT_CULTLIB_ROOT,
|
||||
pollIntervalMs: config.epiphanyOperatorDeliveryPollIntervalMs,
|
||||
});
|
||||
});
|
||||
|
||||
client.on(Events.MessageCreate, async (message) => {
|
||||
|
|
@ -577,61 +563,6 @@ export async function startBot(): Promise<void> {
|
|||
const guildContext = buildGuildContextFromInteraction(interaction);
|
||||
|
||||
switch (interaction.commandName) {
|
||||
case "epiphany": {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
if (!isExactDiscordOwner(actor.id, config.ownerDiscordId)) {
|
||||
await replyEphemeral(
|
||||
interaction,
|
||||
"Refused: Epiphany operator requests require the exact configured Discord owner identity.",
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (!interaction.guildId) {
|
||||
await replyEphemeral(
|
||||
interaction,
|
||||
"Refused: Epiphany operator requests require their exact Discord organization provenance.",
|
||||
);
|
||||
break;
|
||||
}
|
||||
const issuedAt = new Date().toISOString();
|
||||
await registerEpiphanyOperatorInteraction(
|
||||
{
|
||||
requestId: interaction.id,
|
||||
applicationId: interaction.applicationId,
|
||||
interactionToken: interaction.token,
|
||||
guildId: interaction.guildId,
|
||||
channelId: interaction.channelId,
|
||||
registeredAt: issuedAt,
|
||||
},
|
||||
{
|
||||
checkpointStorePath: config.epiphanyOperatorDeliveryCheckpointStorePath,
|
||||
bifrostRoot: config.bifrostRoot,
|
||||
cultlibRoot: process.env.VOIDBOT_CULTLIB_ROOT,
|
||||
},
|
||||
);
|
||||
await replyEphemeral(
|
||||
interaction,
|
||||
`Epiphany operator request \`${interaction.id}\` is pending Bifrost admission. This request grants no Mind, Hands, release, deployment, or local execution authority.`,
|
||||
);
|
||||
const request = await submitEpiphanyOperatorRequest(
|
||||
{
|
||||
interactionId: interaction.id,
|
||||
actorDiscordId: actor.id,
|
||||
guildId: interaction.guildId,
|
||||
channelId: interaction.channelId,
|
||||
command: epiphanyOperatorCommandFromInteraction(interaction),
|
||||
issuedAt,
|
||||
},
|
||||
{
|
||||
storePath: config.bifrostEpiphanyOperatorRequestStorePath,
|
||||
bifrostRoot: config.bifrostRoot,
|
||||
cultlibRoot: process.env.VOIDBOT_CULTLIB_ROOT,
|
||||
producerRuntimeId: "voidbot-yggdrasil",
|
||||
},
|
||||
);
|
||||
if (request.requestId !== interaction.id) throw new Error("Epiphany request identity changed after interaction registration.");
|
||||
break;
|
||||
}
|
||||
case "ask":
|
||||
const requestedProvider = parseProviderOverride(
|
||||
interaction.options.getString("provider", false),
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
import { consumeEpiphanyOperatorDeliveries } from "@voidbot/core";
|
||||
|
||||
export interface EpiphanyOperatorDeliveryConsumerConfig {
|
||||
applicationId: string;
|
||||
requestStorePath: string;
|
||||
deliveryStorePath: string;
|
||||
checkpointStorePath: string;
|
||||
bifrostRoot: string;
|
||||
cultlibRoot?: string;
|
||||
pollIntervalMs: number;
|
||||
}
|
||||
|
||||
export function startEpiphanyOperatorDeliveryConsumer(config: EpiphanyOperatorDeliveryConsumerConfig): void {
|
||||
let running = false;
|
||||
const pulse = async (): Promise<void> => {
|
||||
if (running) return;
|
||||
running = true;
|
||||
try {
|
||||
const result = await consumeEpiphanyOperatorDeliveries(
|
||||
{
|
||||
requestStorePath: config.requestStorePath,
|
||||
deliveryStorePath: config.deliveryStorePath,
|
||||
checkpointStorePath: config.checkpointStorePath,
|
||||
bifrostRoot: config.bifrostRoot,
|
||||
cultlibRoot: config.cultlibRoot,
|
||||
},
|
||||
async (applicationId, interactionToken, content) => {
|
||||
if (applicationId !== config.applicationId) throw new Error("interaction application binding mismatch");
|
||||
const response = await fetch(
|
||||
`https://discord.com/api/v10/webhooks/${encodeURIComponent(applicationId)}/${encodeURIComponent(interactionToken)}/messages/@original`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ content }),
|
||||
},
|
||||
);
|
||||
if (!response.ok) throw new Error(`Discord interaction edit failed with HTTP ${response.status}`);
|
||||
},
|
||||
);
|
||||
if (result.failed > 0) console.error("Epiphany operator delivery pulse retained failures for retry:", result);
|
||||
} catch (error) {
|
||||
console.error("Epiphany operator delivery pulse failed without acknowledging deliveries:", error);
|
||||
} finally { running = false; }
|
||||
};
|
||||
void pulse();
|
||||
const timer = setInterval(() => void pulse(), config.pollIntervalMs);
|
||||
timer.unref?.();
|
||||
}
|
||||
Loading…
Reference in a new issue