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
|
/**
* tool-youtube-transcript extension — registers the `youtube_transcript` tool
* backed by a self-hosted transcriber service on activation.
*
* The base URL comes from `YOUTUBE_TRANSCRIBER_URL` (env) with a Tailscale
* default. Effects (`globalThis.fetch`) come from the ambient edge here, in
* the shell — never in the pure core. Logging is left to the host via
* `host.logger`/`ctx.log` (no `console.*`, no hand-rolled logger).
*/
import type { Extension, HostAPI, Manifest } from "@dispatch/kernel";
import { createTranscriptClient, DEFAULT_BASE_URL } from "./client.js";
import { createYoutubeTranscriptTool } from "./tool.js";
export const manifest: Manifest = {
id: "tool-youtube-transcript",
name: "YouTube Transcript Tool",
version: "0.0.0",
apiVersion: "^0.1.0",
trust: "bundled",
activation: "eager",
capabilities: { network: true },
contributes: { tools: ["youtube_transcript"] },
};
export function activate(host: HostAPI): void {
const baseUrl = process.env.YOUTUBE_TRANSCRIBER_URL ?? DEFAULT_BASE_URL;
const client = createTranscriptClient({ baseUrl, fetchFn: globalThis.fetch });
host.defineTool(createYoutubeTranscriptTool({ client }));
}
export const extension: Extension = { manifest, activate };
|