summaryrefslogtreecommitdiffhomepage
path: root/packages/tool-read-file/src/extension.ts
blob: 273727fa0557c4c2358d8ce57684ec427c0d2f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { execBackendHandle } from "@dispatch/exec-backend";
import type { Extension } from "@dispatch/kernel";
import { createReadFileTool } from "./read-file.js";

export const extension: Extension = {
  manifest: {
    id: "tool-read-file",
    name: "Read File Tool",
    version: "0.0.0",
    apiVersion: "^0.1.0",
    trust: "bundled",
    activation: "eager",
    capabilities: { fs: true },
    contributes: { tools: ["read_file"] },
    // Host activates exec-backend first → host.getService at activation is safe.
    dependsOn: ["exec-backend"],
  },
  activate(host) {
    const resolveBackend = host.getService(execBackendHandle);
    host.defineTool(createReadFileTool({ resolveBackend, workdir: process.cwd() }));
  },
};