-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.ts
More file actions
38 lines (32 loc) · 938 Bytes
/
Copy pathplugin.ts
File metadata and controls
38 lines (32 loc) · 938 Bytes
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
import type { Plugin, PluginInput } from "@opencode-ai/plugin";
import { tool } from "@opencode-ai/plugin";
import { createHashlineEditTool } from "./tool-edit";
import { createReadHook } from "./hook-read";
import { createSnapshotStore } from "./store";
const store = createSnapshotStore();
function getStore() {
return store;
}
const hashlineEditTool = createHashlineEditTool(getStore);
export const opencodeHashlinePlugin: Plugin = async (input: PluginInput) => {
const client = input.client as Record<string, any> | undefined;
try {
await client?.app?.log?.({
body: {
service: "opencode-hashline",
level: "info",
message: "opencode-hashline plugin loaded — edit tool overridden, read hook registered",
},
});
} catch {
// log is best-effort; don't fail if SDK version differs
}
return {
tool: {
edit: hashlineEditTool,
},
"tool.execute.after": createReadHook({
getStore,
}),
};
};