refactor: route channel runtime via plugin api

This commit is contained in:
Peter Steinberger
2026-01-18 11:00:19 +00:00
parent 676d41d415
commit ee6e534ccb
82 changed files with 1253 additions and 3167 deletions

View File

@@ -2,11 +2,28 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { beforeEach, describe, expect, it } from "vitest";
import type { PluginRuntime } from "clawdbot/plugin-sdk";
import { buildMSTeamsPollCard, createMSTeamsPollStoreFs, extractMSTeamsPollVote } from "./polls.js";
import { setMSTeamsRuntime } from "./runtime.js";
const runtimeStub = {
state: {
resolveStateDir: (env: NodeJS.ProcessEnv = process.env, homedir?: () => string) => {
const override = env.CLAWDBOT_STATE_DIR?.trim();
if (override) return override;
const resolvedHome = homedir ? homedir() : os.homedir();
return path.join(resolvedHome, ".clawdbot");
},
},
} as unknown as PluginRuntime;
describe("msteams polls", () => {
beforeEach(() => {
setMSTeamsRuntime(runtimeStub);
});
it("builds poll cards with fallback text", () => {
const card = buildMSTeamsPollCard({
question: "Lunch?",