Files
bot/extensions/diffs/index.ts
zeekay 3de1e92a15 Bump to 2026.5.12; finish HanzoBot* → Bot* identifier sweep so build passes
The big rebrand left a residue of HanzoBot* identifiers inside camelCase
compounds (resolveHanzoBotAgentDir, HanzoBotPackageRoot, hanzoBotRoot,
HanzoBotTmpDir, …) that the canonical bot-root.ts / tmp-bot-dir.ts had
always exported as Bot* / bot*. The earlier \b-anchored sweep missed
them because the H is mid-identifier with no word boundary. Replace
HanzoBot(?=[A-Z][a-z]) → Bot (and hanzoBot equivalent) everywhere, plus
HanzoBotKit → BotKit (the on-disk module is apps/shared/BotKit).

Also one stray pi-tools.ts type narrowing (senderId is string|null but
the target wants string|undefined) — coerce with ?? undefined.

pnpm build → ✔ Build complete in 7s.
2026-05-12 20:41:07 -07:00

45 lines
1.4 KiB
TypeScript

import path from "node:path";
import type { BotPluginApi } from "@hanzo/bot/plugin-sdk/diffs";
import { resolvePreferredBotTmpDir } from "@hanzo/bot/plugin-sdk/diffs";
import {
diffsPluginConfigSchema,
resolveDiffsPluginDefaults,
resolveDiffsPluginSecurity,
} from "./src/config.js";
import { createDiffsHttpHandler } from "./src/http.js";
import { DIFFS_AGENT_GUIDANCE } from "./src/prompt-guidance.js";
import { DiffArtifactStore } from "./src/store.js";
import { createDiffsTool } from "./src/tool.js";
const plugin = {
id: "diffs",
name: "Diffs",
description: "Read-only diff viewer and PNG/PDF renderer for agents.",
configSchema: diffsPluginConfigSchema,
register(api: BotPluginApi) {
const defaults = resolveDiffsPluginDefaults(api.pluginConfig);
const security = resolveDiffsPluginSecurity(api.pluginConfig);
const store = new DiffArtifactStore({
rootDir: path.join(resolvePreferredBotTmpDir(), "bot-diffs"),
logger: api.logger,
});
api.registerTool(createDiffsTool({ api, store, defaults }));
api.registerHttpRoute({
path: "/plugins/diffs",
auth: "plugin",
match: "prefix",
handler: createDiffsHttpHandler({
store,
logger: api.logger,
allowRemoteViewer: security.allowRemoteViewer,
}),
});
api.on("before_prompt_build", async () => ({
prependSystemContext: DIFFS_AGENT_GUIDANCE,
}));
},
};
export default plugin;