Meeting Prep v0.1.2 · generic
Archive SHA-256 f6c52dfbd4a5fb45cf0801bbed11fc75bf8c380b99b8d2ed50fe7b11d31978d1 · 28.6 KB · built Nov 27, 2026
src/index.js
// Meeting Prep — AgentRove native agent (MIT). Offline: works only on the events and notes you supply.
import { defineAgent, AgentError, runCli, runMcpStdio, handleMcpMessage, validateManifest } from "../sdk/index.js";
import { readFileSync } from "node:fs";
import { buildAgenda, prepChecklist, followUpMarkdown, PrepError } from "./prep.js";
const manifest = JSON.parse(readFileSync(new URL("../agent.json", import.meta.url), "utf8"));
function nowMs(input, ctx) {
if (input.now) return Date.parse(input.now);
const n = ctx.now();
return n instanceof Date ? n.getTime() : Date.parse(String(n));
}
// Converts internal validation errors into SDK AgentErrors so CLI/MCP report the right code.
function run(fn) {
try {
return fn();
} catch (e) {
if (e instanceof PrepError) throw new AgentError(e.code, e.message);
throw e;
}
}
const handlers = {
async build_agenda(input, ctx) {
return run(() => buildAgenda(input, nowMs(input, ctx)).agenda);
},
async prep_checklist(input, ctx) {
return run(() => {
const { agenda, notes } = buildAgenda(input, nowMs(input, ctx));
const usingPlaceholder = agenda.items.some((i) => i.source === "event_summary");
return {
event_uid: agenda.event_uid,
title: agenda.title,
start: agenda.start,
local_start: agenda.local_start,
checklist: prepChecklist(agenda, notes, usingPlaceholder),
warnings: agenda.warnings,
};
});
},
async follow_up_template(input, ctx) {
return run(() => {
let agenda = input.agenda;
if (!agenda) {
if (!input.events) throw new AgentError("invalid_input", "Provide either events (with optional notes) or an agenda from build_agenda");
agenda = buildAgenda(input, nowMs(input, ctx)).agenda;
}
return { title: agenda.title, format: "markdown", markdown: followUpMarkdown(agenda) };
});
},
};
const agent = defineAgent(manifest, handlers);
export default agent;
export { manifest, runCli, runMcpStdio, handleMcpMessage, validateManifest };