@framers/agentos-ext-letterboxd 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts ADDED
@@ -0,0 +1,86 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * Letterboxd Extension Pack — provides movie lookup capabilities for agents.
4
+ *
5
+ * Exposes a single `letterboxd_movie` tool that scrapes Letterboxd for film
6
+ * metadata, aggregate ratings, director credits, genre tags, and a sample
7
+ * of recent user reviews. No API key required.
8
+ *
9
+ * The tool supports an optional integration with the web-scraper extension's
10
+ * recipe system: when a `web_scrape_recipe`-compatible tool reference is
11
+ * supplied via `options.recipeTool`, the tool delegates scraping to the
12
+ * recipe engine for more robust, tiered fetching. Otherwise it falls back
13
+ * to a lightweight built-in `fetch()` scraper.
14
+ *
15
+ * @module @framers/agentos-ext-letterboxd
16
+ */
17
+
18
+ import { LetterboxdMovieTool } from './tools/letterboxdMovie.js';
19
+
20
+ import type { RecipeToolLike } from './tools/letterboxdMovie.js';
21
+
22
+ /**
23
+ * Configuration options for the Letterboxd extension pack.
24
+ */
25
+ export interface LetterboxdExtensionOptions {
26
+ /**
27
+ * Optional reference to a `web_scrape_recipe`-compatible tool.
28
+ * When provided, the `letterboxd_movie` tool attempts recipe-based
29
+ * scraping before falling back to the built-in scraper.
30
+ */
31
+ recipeTool?: RecipeToolLike;
32
+
33
+ /**
34
+ * Descriptor priority for tool ordering.
35
+ * Lower numbers are higher priority. Defaults to `50`.
36
+ */
37
+ priority?: number;
38
+ }
39
+
40
+ /**
41
+ * Create the Letterboxd extension pack.
42
+ *
43
+ * @param context - Extension activation context provided by the AgentOS
44
+ * runtime. Must contain an `options` property (or empty
45
+ * object) and optionally a `logger` for lifecycle logging.
46
+ * @returns An extension pack descriptor with a single `letterboxd_movie` tool.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import { createExtensionPack } from '@framers/agentos-ext-letterboxd';
51
+ *
52
+ * const pack = createExtensionPack({ options: {} });
53
+ * // pack.descriptors[0].payload is the LetterboxdMovieTool instance
54
+ * ```
55
+ */
56
+ export function createExtensionPack(context: any) {
57
+ const options = (context.options || {}) as LetterboxdExtensionOptions;
58
+ const tool = new LetterboxdMovieTool(options.recipeTool);
59
+
60
+ return {
61
+ name: '@framers/agentos-ext-letterboxd',
62
+ version: '1.0.0',
63
+ descriptors: [
64
+ {
65
+ // IMPORTANT: ToolExecutor uses descriptor id as the lookup key for tool calls.
66
+ // Keep it aligned with `tool.name`.
67
+ id: tool.name,
68
+ kind: 'tool' as const,
69
+ priority: options.priority || 50,
70
+ payload: tool,
71
+ requiredSecrets: [],
72
+ },
73
+ ],
74
+ onActivate: async () => context.logger?.info('Letterboxd Extension activated'),
75
+ onDeactivate: async () => context.logger?.info('Letterboxd Extension deactivated'),
76
+ };
77
+ }
78
+
79
+ export { LetterboxdMovieTool };
80
+ export type {
81
+ LetterboxdMovieInput,
82
+ LetterboxdMovieOutput,
83
+ LetterboxdReview,
84
+ RecipeToolLike,
85
+ } from './tools/letterboxdMovie.js';
86
+ export default createExtensionPack;