-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.ts
More file actions
39 lines (37 loc) · 1.42 KB
/
Copy pathindex.ts
File metadata and controls
39 lines (37 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
import { basecampChannel } from "./src/channel.js";
import { getSurfacePrompt } from "./src/hooks/agent-prompt-context.js";
import { handleBasecampWebhook } from "./src/inbound/webhooks.js";
import { setBasecampRuntime } from "./src/runtime.js";
const plugin: {
id: string;
name: string;
description: string;
configSchema: ReturnType<typeof emptyPluginConfigSchema>;
register: (api: OpenClawPluginApi) => void;
} = {
id: "openclaw-basecamp",
name: "Basecamp",
description: "Basecamp channel — Campfire, cards, todos, check-ins, pings",
configSchema: emptyPluginConfigSchema(),
register(api: OpenClawPluginApi) {
setBasecampRuntime(api.runtime);
// Cast required: SDK's registerChannel expects ChannelPlugin<unknown> but
// our concrete Probe/Audit type params are contravariant with unknown.
api.registerChannel({ plugin: basecampChannel as any });
api.registerHttpRoute({
path: "/webhooks/basecamp",
handler: handleBasecampWebhook,
auth: "plugin",
});
api.on("before_agent_start", (event) => {
const lines = event.prompt.split(/\r?\n/).filter((l) => l.startsWith("[basecamp] "));
const surfacePrompt = getSurfacePrompt(lines);
if (surfacePrompt) {
return { prependContext: surfacePrompt };
}
});
},
};
export default plugin;