@polpo-ai/tools 0.2.4

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.
Files changed (89) hide show
  1. package/dist/adapters/node-filesystem.d.ts +12 -0
  2. package/dist/adapters/node-filesystem.d.ts.map +1 -0
  3. package/dist/adapters/node-filesystem.js +46 -0
  4. package/dist/adapters/node-filesystem.js.map +1 -0
  5. package/dist/adapters/node-shell.d.ts +5 -0
  6. package/dist/adapters/node-shell.d.ts.map +1 -0
  7. package/dist/adapters/node-shell.js +34 -0
  8. package/dist/adapters/node-shell.js.map +1 -0
  9. package/dist/audio-tools.d.ts +42 -0
  10. package/dist/audio-tools.d.ts.map +1 -0
  11. package/dist/audio-tools.js +552 -0
  12. package/dist/audio-tools.js.map +1 -0
  13. package/dist/browser-tools.d.ts +36 -0
  14. package/dist/browser-tools.d.ts.map +1 -0
  15. package/dist/browser-tools.js +525 -0
  16. package/dist/browser-tools.js.map +1 -0
  17. package/dist/coding-tools.d.ts +99 -0
  18. package/dist/coding-tools.d.ts.map +1 -0
  19. package/dist/coding-tools.js +434 -0
  20. package/dist/coding-tools.js.map +1 -0
  21. package/dist/docx-tools.d.ts +22 -0
  22. package/dist/docx-tools.d.ts.map +1 -0
  23. package/dist/docx-tools.js +236 -0
  24. package/dist/docx-tools.js.map +1 -0
  25. package/dist/email-tools.d.ts +34 -0
  26. package/dist/email-tools.d.ts.map +1 -0
  27. package/dist/email-tools.js +787 -0
  28. package/dist/email-tools.js.map +1 -0
  29. package/dist/excel-tools.d.ts +25 -0
  30. package/dist/excel-tools.d.ts.map +1 -0
  31. package/dist/excel-tools.js +409 -0
  32. package/dist/excel-tools.js.map +1 -0
  33. package/dist/http-tools.d.ts +23 -0
  34. package/dist/http-tools.d.ts.map +1 -0
  35. package/dist/http-tools.js +214 -0
  36. package/dist/http-tools.js.map +1 -0
  37. package/dist/image-tools.d.ts +40 -0
  38. package/dist/image-tools.d.ts.map +1 -0
  39. package/dist/image-tools.js +522 -0
  40. package/dist/image-tools.js.map +1 -0
  41. package/dist/index.d.ts +33 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +37 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/memory-tools.d.ts +19 -0
  46. package/dist/memory-tools.d.ts.map +1 -0
  47. package/dist/memory-tools.js +104 -0
  48. package/dist/memory-tools.js.map +1 -0
  49. package/dist/outcome-tools.d.ts +25 -0
  50. package/dist/outcome-tools.d.ts.map +1 -0
  51. package/dist/outcome-tools.js +191 -0
  52. package/dist/outcome-tools.js.map +1 -0
  53. package/dist/path-sandbox.d.ts +28 -0
  54. package/dist/path-sandbox.d.ts.map +1 -0
  55. package/dist/path-sandbox.js +58 -0
  56. package/dist/path-sandbox.js.map +1 -0
  57. package/dist/pdf-tools.d.ts +25 -0
  58. package/dist/pdf-tools.d.ts.map +1 -0
  59. package/dist/pdf-tools.js +363 -0
  60. package/dist/pdf-tools.js.map +1 -0
  61. package/dist/phone-tools.d.ts +27 -0
  62. package/dist/phone-tools.d.ts.map +1 -0
  63. package/dist/phone-tools.js +577 -0
  64. package/dist/phone-tools.js.map +1 -0
  65. package/dist/safe-env.d.ts +26 -0
  66. package/dist/safe-env.d.ts.map +1 -0
  67. package/dist/safe-env.js +76 -0
  68. package/dist/safe-env.js.map +1 -0
  69. package/dist/search-tools.d.ts +22 -0
  70. package/dist/search-tools.d.ts.map +1 -0
  71. package/dist/search-tools.js +205 -0
  72. package/dist/search-tools.js.map +1 -0
  73. package/dist/ssrf-guard.d.ts +17 -0
  74. package/dist/ssrf-guard.d.ts.map +1 -0
  75. package/dist/ssrf-guard.js +95 -0
  76. package/dist/ssrf-guard.js.map +1 -0
  77. package/dist/types.d.ts +21 -0
  78. package/dist/types.d.ts.map +1 -0
  79. package/dist/types.js +5 -0
  80. package/dist/types.js.map +1 -0
  81. package/dist/vault-tools.d.ts +26 -0
  82. package/dist/vault-tools.d.ts.map +1 -0
  83. package/dist/vault-tools.js +86 -0
  84. package/dist/vault-tools.js.map +1 -0
  85. package/dist/whatsapp-tools.d.ts +18 -0
  86. package/dist/whatsapp-tools.d.ts.map +1 -0
  87. package/dist/whatsapp-tools.js +206 -0
  88. package/dist/whatsapp-tools.js.map +1 -0
  89. package/package.json +56 -0
@@ -0,0 +1,363 @@
1
+ /**
2
+ * PDF tools for document operations.
3
+ *
4
+ * Provides tools for agents to:
5
+ * - Read text from PDF files
6
+ * - Create new PDF documents with text, images, and pages
7
+ * - Merge multiple PDFs into one
8
+ * - Extract pages from a PDF
9
+ * - Get PDF metadata (pages, title, author, etc.)
10
+ *
11
+ * Uses `pdf-lib` for creation/manipulation and a built-in text extractor.
12
+ * All file operations enforce path sandboxing.
13
+ */
14
+ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
15
+ import { resolve, dirname } from "node:path";
16
+ import { Type } from "@sinclair/typebox";
17
+ import { resolveAllowedPaths, assertPathAllowed } from "./path-sandbox.js";
18
+ const MAX_TEXT_OUTPUT = 50_000;
19
+ // ─── Tool: pdf_read ───
20
+ const PdfReadSchema = Type.Object({
21
+ path: Type.String({ description: "Path to PDF file" }),
22
+ pages: Type.Optional(Type.Array(Type.Number(), { description: "Specific page numbers to read (1-indexed). Default: all pages." })),
23
+ max_chars: Type.Optional(Type.Number({ description: "Max characters to return (default: 50000)" })),
24
+ });
25
+ function createPdfReadTool(cwd, sandbox) {
26
+ return {
27
+ name: "pdf_read",
28
+ label: "Read PDF",
29
+ description: "Extract text content from a PDF file. Returns the text from all or specific pages.",
30
+ parameters: PdfReadSchema,
31
+ async execute(_id, params) {
32
+ const filePath = resolve(cwd, params.path);
33
+ assertPathAllowed(filePath, sandbox, "pdf_read");
34
+ try {
35
+ const { PDFDocument } = await import("pdf-lib");
36
+ const bytes = readFileSync(filePath);
37
+ const pdfDoc = await PDFDocument.load(bytes);
38
+ const pageCount = pdfDoc.getPageCount();
39
+ const title = pdfDoc.getTitle() ?? "";
40
+ const author = pdfDoc.getAuthor() ?? "";
41
+ // pdf-lib doesn't extract text - we use a basic approach via page content streams
42
+ // For production, agents should use the bash tool with a CLI like pdftotext
43
+ // Here we provide metadata and suggest using bash for full text extraction
44
+ const maxChars = params.max_chars ?? MAX_TEXT_OUTPUT;
45
+ // Try to extract text using pdf-lib's low-level API
46
+ const selectedPages = params.pages ?? Array.from({ length: pageCount }, (_, i) => i + 1);
47
+ const textParts = [];
48
+ for (const pageNum of selectedPages) {
49
+ if (pageNum < 1 || pageNum > pageCount)
50
+ continue;
51
+ const page = pdfDoc.getPage(pageNum - 1);
52
+ const { width, height } = page.getSize();
53
+ textParts.push(`--- Page ${pageNum} (${Math.round(width)}x${Math.round(height)}) ---`);
54
+ // Note: pdf-lib doesn't support text extraction natively.
55
+ // We extract what we can from content streams
56
+ textParts.push(`[Page ${pageNum} content - use 'bash' tool with 'pdftotext' for full text extraction]`);
57
+ }
58
+ // If pdftotext is available, try to use it
59
+ let extractedText = "";
60
+ try {
61
+ const { execSync } = await import("node:child_process");
62
+ const pagesArg = params.pages
63
+ ? `-f ${Math.min(...params.pages)} -l ${Math.max(...params.pages)}`
64
+ : "";
65
+ extractedText = execSync(`pdftotext ${pagesArg} -layout ${JSON.stringify(filePath)} -`, { encoding: "utf-8", timeout: 15_000 }).trim();
66
+ }
67
+ catch {
68
+ // pdftotext not available - that's fine
69
+ }
70
+ const text = extractedText || textParts.join("\n");
71
+ const truncated = text.length > maxChars
72
+ ? text.slice(0, maxChars) + `\n[truncated — ${text.length} total chars]`
73
+ : text;
74
+ const meta = [
75
+ `PDF: ${filePath}`,
76
+ `Pages: ${pageCount}${title ? ` | Title: ${title}` : ""}${author ? ` | Author: ${author}` : ""}`,
77
+ ``,
78
+ ].join("\n");
79
+ return {
80
+ content: [{ type: "text", text: meta + truncated }],
81
+ details: { path: filePath, pages: pageCount, title, author },
82
+ };
83
+ }
84
+ catch (err) {
85
+ return {
86
+ content: [{ type: "text", text: `PDF read error: ${err.message}` }],
87
+ details: { error: err.message },
88
+ };
89
+ }
90
+ },
91
+ };
92
+ }
93
+ // ─── Tool: pdf_create (HTML → PDF via Playwright/Chromium) ───
94
+ const PdfCreateSchema = Type.Object({
95
+ path: Type.String({ description: "Output PDF file path" }),
96
+ html: Type.Optional(Type.String({ description: "Complete HTML string to render. Must be a full document (<!DOCTYPE html>...). Mutually exclusive with html_path." })),
97
+ html_path: Type.Optional(Type.String({ description: "Path to an HTML file to render. Use this for large documents instead of passing html inline. Mutually exclusive with html." })),
98
+ format: Type.Optional(Type.Union([
99
+ Type.Literal("A4"),
100
+ Type.Literal("A3"),
101
+ Type.Literal("Letter"),
102
+ Type.Literal("Legal"),
103
+ Type.Literal("Tabloid"),
104
+ ], { description: "Paper format (default: A4)" })),
105
+ landscape: Type.Optional(Type.Boolean({ description: "Landscape orientation (default: false)" })),
106
+ margin: Type.Optional(Type.Object({
107
+ top: Type.Optional(Type.String({ description: "Top margin (e.g. '20mm', '1in')" })),
108
+ right: Type.Optional(Type.String({ description: "Right margin (e.g. '15mm')" })),
109
+ bottom: Type.Optional(Type.String({ description: "Bottom margin (e.g. '25mm')" })),
110
+ left: Type.Optional(Type.String({ description: "Left margin (e.g. '15mm')" })),
111
+ }, { description: "Page margins. Default: 20mm top, 15mm right/left, 25mm bottom." })),
112
+ header_template: Type.Optional(Type.String({ description: "HTML template for page header. Supports Chromium classes: pageNumber, totalPages, date, title, url. Pass empty <div></div> for no header." })),
113
+ footer_template: Type.Optional(Type.String({ description: "HTML template for page footer. Example: '<div style=\"font-size:9px;width:100%;text-align:center;color:#888;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>'" })),
114
+ print_background: Type.Optional(Type.Boolean({ description: "Print background colors/images (default: true)" })),
115
+ scale: Type.Optional(Type.Number({ description: "Scale of the webpage rendering (default: 1, range 0.1-2)" })),
116
+ wait_for_network: Type.Optional(Type.Boolean({ description: "Wait for network idle before rendering (default: true). Disable for offline HTML with no external resources." })),
117
+ });
118
+ function createPdfCreateTool(cwd, sandbox) {
119
+ return {
120
+ name: "pdf_create",
121
+ label: "Create PDF",
122
+ description: "Convert HTML to a professional PDF document using Chromium (Playwright). " +
123
+ "Provide a complete HTML document (with CSS, tables, images as base64) either " +
124
+ "inline via 'html' or from a file via 'html_path'. The tool handles rendering " +
125
+ "and PDF generation — you focus on writing the HTML.\n\n" +
126
+ "Supports full CSS: @page rules, page-break-*, flexbox, grid, custom fonts, " +
127
+ "background colors, borders, images (use base64 data URIs for images).\n\n" +
128
+ "Examples:\n" +
129
+ "- Simple report: pdf_create({html: '<!DOCTYPE html><html>...', path: 'report.pdf'})\n" +
130
+ "- From file: pdf_create({html_path: 'report.html', path: 'report.pdf', format: 'A4'})\n" +
131
+ "- With footer: pdf_create({html: '...', path: 'report.pdf', footer_template: '<div style=\"font-size:9px;text-align:center;width:100%\">Page <span class=\"pageNumber\"></span>/<span class=\"totalPages\"></span></div>'})",
132
+ parameters: PdfCreateSchema,
133
+ async execute(_id, params) {
134
+ // Validate: must have exactly one of html or html_path
135
+ if (!params.html && !params.html_path) {
136
+ return {
137
+ content: [{ type: "text", text: "Error: provide either 'html' (inline HTML string) or 'html_path' (path to HTML file)" }],
138
+ details: { error: "missing_html" },
139
+ };
140
+ }
141
+ if (params.html && params.html_path) {
142
+ return {
143
+ content: [{ type: "text", text: "Error: provide 'html' or 'html_path', not both" }],
144
+ details: { error: "both_html_sources" },
145
+ };
146
+ }
147
+ const filePath = resolve(cwd, params.path);
148
+ assertPathAllowed(filePath, sandbox, "pdf_create");
149
+ mkdirSync(dirname(filePath), { recursive: true });
150
+ // Resolve HTML content
151
+ let htmlContent;
152
+ if (params.html_path) {
153
+ const htmlFilePath = resolve(cwd, params.html_path);
154
+ assertPathAllowed(htmlFilePath, sandbox, "pdf_create");
155
+ try {
156
+ htmlContent = readFileSync(htmlFilePath, "utf-8");
157
+ }
158
+ catch (err) {
159
+ return {
160
+ content: [{ type: "text", text: `Error reading HTML file: ${err.message}` }],
161
+ details: { error: "html_read_failed", path: htmlFilePath },
162
+ };
163
+ }
164
+ }
165
+ else {
166
+ htmlContent = params.html;
167
+ }
168
+ let browser;
169
+ try {
170
+ const { chromium } = await import("playwright-core");
171
+ browser = await chromium.launch({
172
+ headless: true,
173
+ args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"],
174
+ });
175
+ const page = await browser.newPage();
176
+ // Load HTML content
177
+ const waitUntil = (params.wait_for_network ?? true) ? "networkidle" : "domcontentloaded";
178
+ await page.setContent(htmlContent, { waitUntil, timeout: 30_000 });
179
+ // Default margins
180
+ const defaultMargin = { top: "20mm", right: "15mm", bottom: "25mm", left: "15mm" };
181
+ const margin = params.margin
182
+ ? { ...defaultMargin, ...params.margin }
183
+ : defaultMargin;
184
+ // Determine if custom header/footer templates are provided
185
+ const hasHeaderFooter = !!(params.header_template || params.footer_template);
186
+ // Generate PDF
187
+ const pdfBuffer = await page.pdf({
188
+ path: filePath,
189
+ format: params.format ?? "A4",
190
+ landscape: params.landscape ?? false,
191
+ printBackground: params.print_background ?? true,
192
+ scale: Math.max(0.1, Math.min(2, params.scale ?? 1)),
193
+ margin,
194
+ displayHeaderFooter: hasHeaderFooter,
195
+ ...(hasHeaderFooter ? {
196
+ headerTemplate: params.header_template ?? "<div></div>",
197
+ footerTemplate: params.footer_template ?? "<div></div>",
198
+ } : {}),
199
+ });
200
+ const bytes = pdfBuffer.byteLength;
201
+ // Count pages in the generated PDF for reporting
202
+ let pageCount = 0;
203
+ try {
204
+ const { PDFDocument } = await import("pdf-lib");
205
+ const doc = await PDFDocument.load(readFileSync(filePath));
206
+ pageCount = doc.getPageCount();
207
+ }
208
+ catch {
209
+ // Best effort — pdf-lib may fail on some PDFs
210
+ }
211
+ const pageInfo = pageCount > 0 ? `${pageCount} pages, ` : "";
212
+ return {
213
+ content: [{ type: "text", text: `PDF created: ${filePath} (${pageInfo}${bytes} bytes)` }],
214
+ details: { path: filePath, pages: pageCount, bytes },
215
+ };
216
+ }
217
+ catch (err) {
218
+ const msg = err.message ?? String(err);
219
+ // Provide actionable hints for common errors
220
+ if (msg.includes("Executable doesn't exist") || msg.includes("browserType.launch")) {
221
+ return {
222
+ content: [{ type: "text", text: `PDF create error: Chromium not found. Install it with: npx playwright install chromium\n\nOriginal error: ${msg}` }],
223
+ details: { error: "chromium_not_installed" },
224
+ };
225
+ }
226
+ return {
227
+ content: [{ type: "text", text: `PDF create error: ${msg}` }],
228
+ details: { error: msg },
229
+ };
230
+ }
231
+ finally {
232
+ if (browser) {
233
+ await browser.close().catch(() => { });
234
+ }
235
+ }
236
+ },
237
+ };
238
+ }
239
+ // ─── Tool: pdf_merge ───
240
+ const PdfMergeSchema = Type.Object({
241
+ inputs: Type.Array(Type.String(), { description: "Paths to PDF files to merge (in order)", minItems: 2 }),
242
+ output: Type.String({ description: "Output merged PDF path" }),
243
+ });
244
+ function createPdfMergeTool(cwd, sandbox) {
245
+ return {
246
+ name: "pdf_merge",
247
+ label: "Merge PDFs",
248
+ description: "Merge multiple PDF files into a single document.",
249
+ parameters: PdfMergeSchema,
250
+ async execute(_id, params) {
251
+ const outputPath = resolve(cwd, params.output);
252
+ assertPathAllowed(outputPath, sandbox, "pdf_merge");
253
+ mkdirSync(dirname(outputPath), { recursive: true });
254
+ try {
255
+ const { PDFDocument } = await import("pdf-lib");
256
+ const merged = await PDFDocument.create();
257
+ let totalPages = 0;
258
+ for (const inputPath of params.inputs) {
259
+ const fullPath = resolve(cwd, inputPath);
260
+ assertPathAllowed(fullPath, sandbox, "pdf_merge");
261
+ const bytes = readFileSync(fullPath);
262
+ const src = await PDFDocument.load(bytes);
263
+ const indices = Array.from({ length: src.getPageCount() }, (_, i) => i);
264
+ const copiedPages = await merged.copyPages(src, indices);
265
+ copiedPages.forEach(p => merged.addPage(p));
266
+ totalPages += copiedPages.length;
267
+ }
268
+ const mergedBytes = await merged.save();
269
+ writeFileSync(outputPath, mergedBytes);
270
+ return {
271
+ content: [{ type: "text", text: `Merged ${params.inputs.length} PDFs -> ${outputPath} (${totalPages} pages, ${mergedBytes.byteLength} bytes)` }],
272
+ details: { output: outputPath, inputs: params.inputs.length, totalPages },
273
+ };
274
+ }
275
+ catch (err) {
276
+ return {
277
+ content: [{ type: "text", text: `PDF merge error: ${err.message}` }],
278
+ details: { error: err.message },
279
+ };
280
+ }
281
+ },
282
+ };
283
+ }
284
+ // ─── Tool: pdf_info ───
285
+ const PdfInfoSchema = Type.Object({
286
+ path: Type.String({ description: "Path to PDF file" }),
287
+ });
288
+ function createPdfInfoTool(cwd, sandbox) {
289
+ return {
290
+ name: "pdf_info",
291
+ label: "PDF Info",
292
+ description: "Get metadata about a PDF: page count, title, author, creation date, page dimensions.",
293
+ parameters: PdfInfoSchema,
294
+ async execute(_id, params) {
295
+ const filePath = resolve(cwd, params.path);
296
+ assertPathAllowed(filePath, sandbox, "pdf_info");
297
+ try {
298
+ const { PDFDocument } = await import("pdf-lib");
299
+ const bytes = readFileSync(filePath);
300
+ const pdfDoc = await PDFDocument.load(bytes);
301
+ const pages = pdfDoc.getPageCount();
302
+ const title = pdfDoc.getTitle() ?? "";
303
+ const author = pdfDoc.getAuthor() ?? "";
304
+ const subject = pdfDoc.getSubject() ?? "";
305
+ const creator = pdfDoc.getCreator() ?? "";
306
+ const producer = pdfDoc.getProducer() ?? "";
307
+ const creationDate = pdfDoc.getCreationDate();
308
+ const modDate = pdfDoc.getModificationDate();
309
+ const pageSizes = Array.from({ length: Math.min(pages, 10) }, (_, i) => {
310
+ const p = pdfDoc.getPage(i);
311
+ const { width, height } = p.getSize();
312
+ return ` Page ${i + 1}: ${Math.round(width)}x${Math.round(height)} pts`;
313
+ });
314
+ const text = [
315
+ `Pages: ${pages}`,
316
+ title ? `Title: ${title}` : null,
317
+ author ? `Author: ${author}` : null,
318
+ subject ? `Subject: ${subject}` : null,
319
+ creator ? `Creator: ${creator}` : null,
320
+ producer ? `Producer: ${producer}` : null,
321
+ creationDate ? `Created: ${creationDate.toISOString()}` : null,
322
+ modDate ? `Modified: ${modDate.toISOString()}` : null,
323
+ `File size: ${bytes.byteLength} bytes`,
324
+ `\nPage dimensions:`,
325
+ ...pageSizes,
326
+ pages > 10 ? ` ... (${pages - 10} more pages)` : null,
327
+ ].filter(Boolean).join("\n");
328
+ return {
329
+ content: [{ type: "text", text }],
330
+ details: { pages, title, author, bytes: bytes.byteLength },
331
+ };
332
+ }
333
+ catch (err) {
334
+ return {
335
+ content: [{ type: "text", text: `PDF info error: ${err.message}` }],
336
+ details: { error: err.message },
337
+ };
338
+ }
339
+ },
340
+ };
341
+ }
342
+ export const ALL_PDF_TOOL_NAMES = ["pdf_read", "pdf_create", "pdf_merge", "pdf_info"];
343
+ /**
344
+ * Create PDF tools.
345
+ *
346
+ * @param cwd - Working directory
347
+ * @param allowedPaths - Sandbox paths
348
+ * @param allowedTools - Optional filter
349
+ */
350
+ export function createPdfTools(cwd, allowedPaths, allowedTools) {
351
+ const sandbox = resolveAllowedPaths(cwd, allowedPaths);
352
+ const factories = {
353
+ pdf_read: () => createPdfReadTool(cwd, sandbox),
354
+ pdf_create: () => createPdfCreateTool(cwd, sandbox),
355
+ pdf_merge: () => createPdfMergeTool(cwd, sandbox),
356
+ pdf_info: () => createPdfInfoTool(cwd, sandbox),
357
+ };
358
+ const names = allowedTools
359
+ ? ALL_PDF_TOOL_NAMES.filter(n => allowedTools.some(a => a.toLowerCase() === n))
360
+ : ALL_PDF_TOOL_NAMES;
361
+ return names.map(n => factories[n]());
362
+ }
363
+ //# sourceMappingURL=pdf-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-tools.js","sourceRoot":"","sources":["../src/pdf-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,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,CAAC;oBACnE,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE;iBAChC,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAMD,MAAM,CAAC,MAAM,kBAAkB,GAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,YAAuB,EAAE,YAAuB;IAC1F,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEvD,MAAM,SAAS,GAA8C;QAC3D,QAAQ,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC;QAC/C,UAAU,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC;QACnD,SAAS,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC;QACjD,QAAQ,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC;KAChD,CAAC;IAEF,MAAM,KAAK,GAAG,YAAY;QACxB,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,kBAAkB,CAAC;IAEvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Phone call tools powered by VAPI (vapi.ai).
3
+ *
4
+ * Provides AI-driven phone call capabilities: make outbound calls with
5
+ * natural language instructions, list recent calls, get call details
6
+ * (transcript, summary, recording), and hang up active calls.
7
+ *
8
+ * Requires VAPI_API_KEY and VAPI_PHONE_NUMBER_ID in vault or environment.
9
+ *
10
+ * Tools:
11
+ * - phone_call: Make an outbound phone call with AI assistant
12
+ * - phone_get_call: Get details of a specific call (transcript, summary, recording)
13
+ * - phone_list_calls: List recent phone calls with status
14
+ * - phone_hangup: Terminate an active phone call
15
+ */
16
+ import type { AgentTool } from "@mariozechner/pi-agent-core";
17
+ import type { ResolvedVault } from "./types.js";
18
+ export type PhoneToolName = "phone_call" | "phone_get_call" | "phone_list_calls" | "phone_hangup" | "phone_setup_inbound" | "phone_get_inbound_config" | "phone_disable_inbound";
19
+ export declare const ALL_PHONE_TOOL_NAMES: readonly PhoneToolName[];
20
+ /**
21
+ * Create VAPI-powered phone call tools.
22
+ *
23
+ * @param vault - Resolved vault credentials (looks for VAPI_API_KEY, VAPI_PHONE_NUMBER_ID)
24
+ * @param allowedTools - Optional filter
25
+ */
26
+ export declare function createPhoneTools(vault?: ResolvedVault, allowedTools?: string[]): AgentTool<any>[];
27
+ //# sourceMappingURL=phone-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone-tools.d.ts","sourceRoot":"","sources":["../src/phone-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAorBhD,MAAM,MAAM,aAAa,GACrB,YAAY,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc,GACrE,qBAAqB,GAAG,0BAA0B,GAAG,uBAAuB,CAAC;AAEjF,eAAO,MAAM,oBAAoB,EAAE,SAAS,aAAa,EAGxD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,aAAa,EACrB,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,SAAS,CAAC,GAAG,CAAC,EAAE,CAgBlB"}