fn(account$0, content$1, after_time_ms$9, then$2) =>
match @std.base64-to-bytes(text: $0.account_id) {
#none(_) =>
$2(errors: ["The account id of the MCP account is not Base64"]),
#some(account_id_bytes$3) =>
#read_time<@definy.service-io>({
then: fn(now_ms$4) =>
let inner$5 = @cbor.encode(
item: @definy.event-inner-cbor(
account_id_bytes: $3,
time_seconds: @std.max(
a: @core.divide(left: $4, right: 1000),
b: @core.plus(left: @core.divide(left: $9, right: 1000), right: 1)
),
content: $1
)
);
#sign_mcp_account<@definy.service-io>({
message: $5,
then: fn(signature$6) =>
match $6 {
#none(_) =>
$2(errors: ["The MCP account could not sign (DEFINY_MCP_ACCOUNT_SECRET_KEY is not set)"]),
#some(bytes$7) =>
@definy.check-snapshot(
signed_event_bytes: @std.bytes-to-base64(bytes: @cbor.encode(item: @definy.signed-event-cbor(signature: $7, event_binary: $5))),
then: fn(errors$8, commit$10) =>
$2(errors: $8)
)
}
})
})
}