@5ss/ai-tools 2.11.3 → 2.11.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.
- package/CHANGELOG.md +2 -0
- package/README.md +3 -10
- package/dist/{bedrock-agentcore-browser-a_qOs-NR.js → bedrock-agentcore-browser-o_oqSPMK.js} +2 -2
- package/dist/{bedrock-agentcore-browser-a_qOs-NR.js.map → bedrock-agentcore-browser-o_oqSPMK.js.map} +1 -1
- package/dist/{bedrock-agentcore-code-interpreter-MWK-8RhA.js → bedrock-agentcore-code-interpreter-D4ERRFj1.js} +2 -2
- package/dist/{bedrock-agentcore-code-interpreter-MWK-8RhA.js.map → bedrock-agentcore-code-interpreter-D4ERRFj1.js.map} +1 -1
- package/dist/{cloudflare-browser-B6Yolpin.js → cloudflare-browser-nLJdH5nG.js} +3 -3
- package/dist/{cloudflare-browser-B6Yolpin.js.map → cloudflare-browser-nLJdH5nG.js.map} +1 -1
- package/dist/{cloudflare-email-Dy0KHeDf.js → cloudflare-email-CSRq8mRd.js} +2 -2
- package/dist/{cloudflare-email-Dy0KHeDf.js.map → cloudflare-email-CSRq8mRd.js.map} +1 -1
- package/dist/{cloudflare-sandbox-Dp_uNaqW.js → cloudflare-sandbox-Be7SeS4-.js} +3 -3
- package/dist/{cloudflare-sandbox-Dp_uNaqW.js.map → cloudflare-sandbox-Be7SeS4-.js.map} +1 -1
- package/dist/content-type-E4_Qdoa0.js +19 -0
- package/dist/{content-type-CORxaxcv.js.map → content-type-E4_Qdoa0.js.map} +1 -1
- package/dist/core/index.js +2 -6
- package/dist/core/index.js.map +1 -1
- package/dist/{define-CvpJ_pNP.js → define-ieoksEQ0.js} +1 -6
- package/dist/define-ieoksEQ0.js.map +1 -0
- package/dist/{eventbridge-scheduler-Bh6GqZY2.js → eventbridge-scheduler-BhQaReAz.js} +2 -2
- package/dist/{eventbridge-scheduler-Bh6GqZY2.js.map → eventbridge-scheduler-BhQaReAz.js.map} +1 -1
- package/dist/{client-CCKGsTeI.js → imessage-CofjmONG.js} +152 -2
- package/dist/imessage-CofjmONG.js.map +1 -0
- package/dist/index-CZX5OeOF.d.ts.map +1 -1
- package/dist/{mastra-vector-Dhc6XZ8l.js → mastra-vector-B8HjvdMT.js} +2 -2
- package/dist/{mastra-vector-Dhc6XZ8l.js.map → mastra-vector-B8HjvdMT.js.map} +1 -1
- package/dist/modules/artifacts/index.js +3 -3
- package/dist/modules/browser/index.js +3 -3
- package/dist/modules/calendar/index.js +1 -1
- package/dist/modules/code-sandbox/index.js +3 -3
- package/dist/modules/content-type/index.js +2 -2
- package/dist/modules/crypto/index.js +1 -1
- package/dist/modules/document-extract/index.js +2 -2
- package/dist/modules/document-render/index.d.ts +21 -30
- package/dist/modules/document-render/index.d.ts.map +1 -1
- package/dist/modules/document-render/index.js +11 -28
- package/dist/modules/document-render/index.js.map +1 -1
- package/dist/modules/email/index.d.ts +19 -1
- package/dist/modules/email/index.d.ts.map +1 -1
- package/dist/modules/email/index.js +3 -3
- package/dist/modules/email-message/index.js +1 -1
- package/dist/modules/files/index.js +2 -2
- package/dist/modules/image/index.d.ts +4 -1
- package/dist/modules/image/index.d.ts.map +1 -1
- package/dist/modules/image/index.js +25 -4
- package/dist/modules/image/index.js.map +1 -1
- package/dist/modules/messaging/index.js +7 -7
- package/dist/modules/messaging/index.js.map +1 -1
- package/dist/modules/queue/index.js +2 -2
- package/dist/modules/rag/index.js +2 -2
- package/dist/modules/scheduler/index.js +2 -2
- package/dist/modules/skills/index.js +1 -1
- package/dist/modules/tasks/index.js +1 -1
- package/dist/modules/vector-store/index.js +1 -1
- package/dist/modules/web-fetch/index.js +1 -1
- package/dist/{pinecone-umY4t6OF.js → pinecone-CNnCFmix.js} +2 -2
- package/dist/{pinecone-umY4t6OF.js.map → pinecone-CNnCFmix.js.map} +1 -1
- package/dist/{qdrant-DMp4NhKR.js → qdrant-R_FIcG9d.js} +2 -2
- package/dist/{qdrant-DMp4NhKR.js.map → qdrant-R_FIcG9d.js.map} +1 -1
- package/dist/{resend-BAC38_dA.js → resend-Bu0NFO3h.js} +2 -2
- package/dist/{resend-BAC38_dA.js.map → resend-Bu0NFO3h.js.map} +1 -1
- package/dist/{s3-CsOaPWMP.js → s3-Dj7Teh-A.js} +2 -2
- package/dist/{s3-CsOaPWMP.js.map → s3-Dj7Teh-A.js.map} +1 -1
- package/dist/{slack-Di5BBNpt.js → slack-AjJDNnXJ.js} +2 -2
- package/dist/{slack-Di5BBNpt.js.map → slack-AjJDNnXJ.js.map} +1 -1
- package/dist/{sqs-DCwS1i2N.js → sqs-CjyXjasF.js} +2 -2
- package/dist/{sqs-DCwS1i2N.js.map → sqs-CjyXjasF.js.map} +1 -1
- package/dist/{supabase-vector-Dpp9mmJR.js → supabase-vector-BNoJZuft.js} +2 -2
- package/dist/{supabase-vector-Dpp9mmJR.js.map → supabase-vector-BNoJZuft.js.map} +1 -1
- package/dist/{teams-DYAHNb39.js → teams-CvxYLAi5.js} +2 -2
- package/dist/{teams-DYAHNb39.js.map → teams-CvxYLAi5.js.map} +1 -1
- package/dist/{telegram-DDXWzkfL.js → telegram-B_-Jljk3.js} +2 -2
- package/dist/{telegram-DDXWzkfL.js.map → telegram-B_-Jljk3.js.map} +1 -1
- package/dist/{textract-CPLiB22H.js → textract-CAfnGvua.js} +3 -3
- package/dist/{textract-CPLiB22H.js.map → textract-CAfnGvua.js.map} +1 -1
- package/dist/{vector-store-C3nEO80e.js → vector-store-DDiu3XPg.js} +6 -6
- package/dist/{vector-store-C3nEO80e.js.map → vector-store-DDiu3XPg.js.map} +1 -1
- package/dist/vendors/amazon-sp-api/index.js +339 -2
- package/dist/vendors/amazon-sp-api/index.js.map +1 -1
- package/dist/vendors/bedrock-agentcore-browser/index.js +1 -1
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +1 -1
- package/dist/vendors/cloudflare-browser/index.js +1 -1
- package/dist/vendors/cloudflare-email/index.js +1 -1
- package/dist/vendors/cloudflare-sandbox/index.js +1 -1
- package/dist/vendors/eventbridge-scheduler/index.js +1 -1
- package/dist/vendors/imessage/index.js +1 -2
- package/dist/vendors/katana/index.js +1 -1
- package/dist/vendors/mastra-vector/index.js +1 -1
- package/dist/vendors/pinecone/index.js +1 -1
- package/dist/vendors/qdrant/index.js +1 -1
- package/dist/vendors/resend/index.js +1 -1
- package/dist/vendors/s3/index.js +1 -1
- package/dist/vendors/slack/index.js +1 -1
- package/dist/vendors/sqs/index.js +1 -1
- package/dist/vendors/supabase-vector/index.js +1 -1
- package/dist/vendors/teams/index.js +1 -1
- package/dist/vendors/telegram/index.js +1 -1
- package/dist/vendors/textract/index.js +1 -1
- package/dist/vendors/woocommerce/index.js +1 -1
- package/logos/README.md +0 -4
- package/logos/pack-logos.json +0 -5
- package/package.json +3 -38
- package/dist/artifacts-O8g-40Pw.js +0 -404
- package/dist/artifacts-O8g-40Pw.js.map +0 -1
- package/dist/batch-BMM5dXqL.d.ts +0 -22
- package/dist/batch-BMM5dXqL.d.ts.map +0 -1
- package/dist/client-CCKGsTeI.js.map +0 -1
- package/dist/content-type-CORxaxcv.js +0 -49
- package/dist/define-CvpJ_pNP.js.map +0 -1
- package/dist/esm-BDrCssjb.js +0 -957
- package/dist/esm-BDrCssjb.js.map +0 -1
- package/dist/gotenberg-NuJjxyln.js +0 -291
- package/dist/gotenberg-NuJjxyln.js.map +0 -1
- package/dist/imessage-BSAFOI8Z.js +0 -154
- package/dist/imessage-BSAFOI8Z.js.map +0 -1
- package/dist/modules/document/index.d.ts +0 -575
- package/dist/modules/document/index.d.ts.map +0 -1
- package/dist/modules/document/index.js +0 -444
- package/dist/modules/document/index.js.map +0 -1
- package/dist/modules/file-convert/index.d.ts +0 -273
- package/dist/modules/file-convert/index.d.ts.map +0 -1
- package/dist/modules/file-convert/index.js +0 -103
- package/dist/modules/file-convert/index.js.map +0 -1
- package/dist/modules/pdf/index.d.ts +0 -287
- package/dist/modules/pdf/index.d.ts.map +0 -1
- package/dist/modules/pdf/index.js +0 -259
- package/dist/modules/pdf/index.js.map +0 -1
- package/dist/modules/presentation/index.d.ts +0 -247
- package/dist/modules/presentation/index.d.ts.map +0 -1
- package/dist/modules/presentation/index.js +0 -11721
- package/dist/modules/presentation/index.js.map +0 -1
- package/dist/object-artifact-store-BVLietAc.d.ts +0 -7
- package/dist/object-artifact-store-BVLietAc.d.ts.map +0 -1
- package/dist/object-artifact-store-wZ2j9cto.js +0 -28
- package/dist/object-artifact-store-wZ2j9cto.js.map +0 -1
- package/dist/vendors/gotenberg/index.d.ts +0 -306
- package/dist/vendors/gotenberg/index.d.ts.map +0 -1
- package/dist/vendors/gotenberg/index.js +0 -2
- package/logos/document.svg +0 -10
- package/logos/file-convert.svg +0 -9
- package/logos/gotenberg.svg +0 -340
- package/logos/pdf.svg +0 -10
- package/logos/presentation.svg +0 -8
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { a as ModuleDefinition, o as ToolContext, s as ToolDefinition } from "../../types-Ccb0DXY9.js";
|
|
2
2
|
import "../../index-CZX5OeOF.js";
|
|
3
|
-
import "../../index-9oSRRNdR.js";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
//#region src/modules/document-render/contracts.d.ts
|
|
6
5
|
declare const documentRenderAuthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
-
gotenberg_base_url: z.ZodURL;
|
|
8
|
-
gotenberg_api_username: z.ZodOptional<z.ZodString>;
|
|
9
|
-
gotenberg_api_password: z.ZodOptional<z.ZodString>;
|
|
10
|
-
storage: z.ZodObject<{
|
|
11
|
-
access_key_id: z.ZodString;
|
|
12
|
-
secret_access_key: z.ZodString;
|
|
13
|
-
region: z.ZodString;
|
|
14
|
-
bucket: z.ZodString;
|
|
15
|
-
endpoint: z.ZodOptional<z.ZodURL>;
|
|
16
|
-
session_token: z.ZodOptional<z.ZodString>;
|
|
17
|
-
key_prefix: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
provider: z.ZodLiteral<"gotenberg">;
|
|
20
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
21
6
|
account_id: z.ZodString;
|
|
22
7
|
api_token: z.ZodString;
|
|
23
8
|
browser: z.ZodOptional<z.ZodEnum<{
|
|
@@ -36,7 +21,7 @@ declare const documentRenderAuthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
36
21
|
provider: z.ZodLiteral<"cloudflare-browser">;
|
|
37
22
|
}, z.core.$strip>], "provider">;
|
|
38
23
|
type DocumentRenderAuth = z.infer<typeof documentRenderAuthSchema>;
|
|
39
|
-
/**
|
|
24
|
+
/** Capability I/O — re-export Cloudflare Browser shapes under seam names. */
|
|
40
25
|
declare const renderPdfInputSchema: z.ZodObject<{
|
|
41
26
|
source: z.ZodObject<{
|
|
42
27
|
html: z.ZodOptional<z.ZodString>;
|
|
@@ -44,6 +29,10 @@ declare const renderPdfInputSchema: z.ZodObject<{
|
|
|
44
29
|
}, z.core.$strip>;
|
|
45
30
|
output_key: z.ZodOptional<z.ZodString>;
|
|
46
31
|
filename: z.ZodOptional<z.ZodString>;
|
|
32
|
+
browser: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
chromium: "chromium";
|
|
34
|
+
kitesurf: "kitesurf";
|
|
35
|
+
}>>;
|
|
47
36
|
}, z.core.$strip>;
|
|
48
37
|
declare const renderScreenshotInputSchema: z.ZodObject<{
|
|
49
38
|
source: z.ZodObject<{
|
|
@@ -57,6 +46,10 @@ declare const renderScreenshotInputSchema: z.ZodObject<{
|
|
|
57
46
|
height: z.ZodInt;
|
|
58
47
|
device_scale_factor: z.ZodOptional<z.ZodNumber>;
|
|
59
48
|
}, z.core.$strip>>;
|
|
49
|
+
browser: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
chromium: "chromium";
|
|
51
|
+
kitesurf: "kitesurf";
|
|
52
|
+
}>>;
|
|
60
53
|
}, z.core.$strip>;
|
|
61
54
|
declare const renderOutputSchema: z.ZodObject<{
|
|
62
55
|
result: z.ZodObject<{
|
|
@@ -82,6 +75,10 @@ declare const renderPdfBatchInputSchema: z.ZodObject<{
|
|
|
82
75
|
}, z.core.$strip>;
|
|
83
76
|
output_key: z.ZodOptional<z.ZodString>;
|
|
84
77
|
filename: z.ZodOptional<z.ZodString>;
|
|
78
|
+
browser: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
chromium: "chromium";
|
|
80
|
+
kitesurf: "kitesurf";
|
|
81
|
+
}>>;
|
|
85
82
|
}, z.core.$strip>>;
|
|
86
83
|
}, z.core.$strip>;
|
|
87
84
|
declare const renderScreenshotBatchInputSchema: z.ZodObject<{
|
|
@@ -97,6 +94,10 @@ declare const renderScreenshotBatchInputSchema: z.ZodObject<{
|
|
|
97
94
|
height: z.ZodInt;
|
|
98
95
|
device_scale_factor: z.ZodOptional<z.ZodNumber>;
|
|
99
96
|
}, z.core.$strip>>;
|
|
97
|
+
browser: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
chromium: "chromium";
|
|
99
|
+
kitesurf: "kitesurf";
|
|
100
|
+
}>>;
|
|
100
101
|
}, z.core.$strip>>;
|
|
101
102
|
}, z.core.$strip>;
|
|
102
103
|
declare const renderPdfBatchOutputSchema: z.ZodObject<{
|
|
@@ -201,6 +202,7 @@ declare const documentRenderPdfTool: ToolDefinition<{
|
|
|
201
202
|
};
|
|
202
203
|
output_key?: string | undefined;
|
|
203
204
|
filename?: string | undefined;
|
|
205
|
+
browser?: "chromium" | "kitesurf" | undefined;
|
|
204
206
|
}, {
|
|
205
207
|
result: {
|
|
206
208
|
store: "host" | "object";
|
|
@@ -223,6 +225,7 @@ declare const documentRenderScreenshotTool: ToolDefinition<{
|
|
|
223
225
|
height: number;
|
|
224
226
|
device_scale_factor?: number | undefined;
|
|
225
227
|
} | undefined;
|
|
228
|
+
browser?: "chromium" | "kitesurf" | undefined;
|
|
226
229
|
}, {
|
|
227
230
|
result: {
|
|
228
231
|
store: "host" | "object";
|
|
@@ -241,6 +244,7 @@ declare const documentRenderPdfBatchTool: ToolDefinition<{
|
|
|
241
244
|
};
|
|
242
245
|
output_key?: string | undefined;
|
|
243
246
|
filename?: string | undefined;
|
|
247
|
+
browser?: "chromium" | "kitesurf" | undefined;
|
|
244
248
|
}[];
|
|
245
249
|
}, {
|
|
246
250
|
results: {
|
|
@@ -278,6 +282,7 @@ declare const documentRenderScreenshotBatchTool: ToolDefinition<{
|
|
|
278
282
|
height: number;
|
|
279
283
|
device_scale_factor?: number | undefined;
|
|
280
284
|
} | undefined;
|
|
285
|
+
browser?: "chromium" | "kitesurf" | undefined;
|
|
281
286
|
}[];
|
|
282
287
|
}, {
|
|
283
288
|
results: {
|
|
@@ -303,20 +308,6 @@ declare const documentRenderScreenshotBatchTool: ToolDefinition<{
|
|
|
303
308
|
failed: number;
|
|
304
309
|
}>;
|
|
305
310
|
declare const documentRenderModule: ModuleDefinition<{
|
|
306
|
-
gotenberg_base_url: string;
|
|
307
|
-
gotenberg_api_username?: string | undefined;
|
|
308
|
-
gotenberg_api_password?: string | undefined;
|
|
309
|
-
storage: {
|
|
310
|
-
access_key_id: string;
|
|
311
|
-
secret_access_key: string;
|
|
312
|
-
region: string;
|
|
313
|
-
bucket: string;
|
|
314
|
-
endpoint?: string | undefined;
|
|
315
|
-
session_token?: string | undefined;
|
|
316
|
-
key_prefix?: string | undefined;
|
|
317
|
-
};
|
|
318
|
-
provider: "gotenberg";
|
|
319
|
-
} | {
|
|
320
311
|
account_id: string;
|
|
321
312
|
api_token: string;
|
|
322
313
|
browser?: "chromium" | "kitesurf" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/modules/document-render/contracts.ts","../../../src/modules/document-render/client.ts","../../../src/modules/document-render/module.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/modules/document-render/contracts.ts","../../../src/modules/document-render/client.ts","../../../src/modules/document-render/module.ts"],"mappings":";;;;cAmBa,0BAAwB,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;GAAgF,EAAA,KAAA;KAEzG,qBAAqB,EAAE,aAAa;;cAGnC,sBAAoB,EAAA;;;;;;;;;;;GAAwC,EAAA,KAAA;cAC5D,6BAA2B,EAAA;;;;;;;;;;;;;;;;GAA+C,EAAA,KAAA;cAC1E,oBAAkB,EAAA;;;;;;;;;;;;;;;GAAsC,EAAA,KAAA;cAExD,2BAAyB,EAAA;;;;;;;;;;;;;GAEpC,EAAA,KAAA;cAEW,kCAAgC,EAAA;;;;;;;;;;;;;;;;;;GAE3C,EAAA,KAAA;cAEW,4BAA0B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwC,EAAA,KAAA;cAClE,mCAAiC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwC,EAAA,KAAA;KAE1E,iBAAiB,EAAE,aAAa;KAChC,wBAAwB,EAAE,aAAa;KACvC,eAAe,EAAE,aAAa;KAM9B;EACX,YAAY,OAAO,mBAAmB,QAAQ;EAC9C,mBAAmB,OAAO,0BAA0B,QAAQ;;;;cCxBhD,gCAAgC;;EAG5C,YAAY,KAAK;SAIV,YAAY,KAAK,cAAc;SAK/B,SAAS,MAAM,oBAAoB,MAAK,cAAmB;EAIlE,UAAU,OAAO,iBAAc;;;;;;;;;;EAI/B,iBAAiB,OAAO,wBAAqB;;;;;;;;;;;;;cC5BjC,uBAAA;;;;;;;;;;;;;;;;;;cAYA,8BAAA;;;;;;;;;;;;;;;;;;;;;;;cAYA,4BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAeA,mCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAeA,sBAAA"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
1
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
2
2
|
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
3
3
|
import { n as runBatchItems, t as batchResultSchema } from "../../batch-Co1ujeAW.js";
|
|
4
|
-
import { c as CloudflareBrowserClient, f as cloudflareBrowserAuthSchema } from "../../cloudflare-browser-
|
|
5
|
-
import { g as gotenbergRenderScreenshotInputSchema, h as gotenbergRenderPdfInputSchema, l as gotenbergAuthSchema, m as gotenbergRenderOutputSchema, o as GotenbergClient } from "../../gotenberg-NuJjxyln.js";
|
|
4
|
+
import { _ as cloudflareBrowserRenderScreenshotInputSchema, c as CloudflareBrowserClient, f as cloudflareBrowserAuthSchema, g as cloudflareBrowserRenderPdfInputSchema, h as cloudflareBrowserRenderOutputSchema } from "../../cloudflare-browser-nLJdH5nG.js";
|
|
6
5
|
import { z } from "zod";
|
|
7
|
-
|
|
6
|
+
/** Host auth: vendor credentials + provider discriminator. */
|
|
8
7
|
const cloudflareBrowserDocumentRenderAuthSchema = cloudflareBrowserAuthSchema.extend({ provider: z.literal("cloudflare-browser") });
|
|
9
|
-
const documentRenderAuthSchema = z.discriminatedUnion("provider", [
|
|
10
|
-
/**
|
|
11
|
-
const renderPdfInputSchema =
|
|
12
|
-
const renderScreenshotInputSchema =
|
|
13
|
-
const renderOutputSchema =
|
|
8
|
+
const documentRenderAuthSchema = z.discriminatedUnion("provider", [cloudflareBrowserDocumentRenderAuthSchema]);
|
|
9
|
+
/** Capability I/O — re-export Cloudflare Browser shapes under seam names. */
|
|
10
|
+
const renderPdfInputSchema = cloudflareBrowserRenderPdfInputSchema;
|
|
11
|
+
const renderScreenshotInputSchema = cloudflareBrowserRenderScreenshotInputSchema;
|
|
12
|
+
const renderOutputSchema = cloudflareBrowserRenderOutputSchema;
|
|
14
13
|
const renderPdfBatchInputSchema = z.object({ items: z.array(renderPdfInputSchema).min(1).max(10).describe("PDF render jobs (max 10)") });
|
|
15
14
|
const renderScreenshotBatchInputSchema = z.object({ items: z.array(renderScreenshotInputSchema).min(1).max(10).describe("Screenshot jobs (max 10)") });
|
|
16
15
|
const renderPdfBatchOutputSchema = batchResultSchema(renderOutputSchema);
|
|
@@ -31,24 +30,9 @@ var CloudflareBrowserDocumentRenderProvider = class {
|
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
32
|
//#endregion
|
|
34
|
-
//#region src/modules/document-render/providers/gotenberg.ts
|
|
35
|
-
var GotenbergDocumentRenderProvider = class {
|
|
36
|
-
#client;
|
|
37
|
-
constructor(auth, options = {}) {
|
|
38
|
-
const { provider: _p, ...vendorAuth } = auth;
|
|
39
|
-
this.#client = new GotenbergClient(vendorAuth, options);
|
|
40
|
-
}
|
|
41
|
-
renderPdf(input) {
|
|
42
|
-
return this.#client.renderPdf(input);
|
|
43
|
-
}
|
|
44
|
-
renderScreenshot(input) {
|
|
45
|
-
return this.#client.renderScreenshot(input);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
33
|
//#region src/modules/document-render/client.ts
|
|
50
34
|
/**
|
|
51
|
-
* Document-render seam client — picks
|
|
35
|
+
* Document-render seam client — picks cloudflare-browser from host auth.
|
|
52
36
|
*/
|
|
53
37
|
function transportOptions(ctx) {
|
|
54
38
|
return {
|
|
@@ -59,7 +43,6 @@ function transportOptions(ctx) {
|
|
|
59
43
|
function providerFor(auth, ctx) {
|
|
60
44
|
const options = transportOptions(ctx);
|
|
61
45
|
switch (auth.provider) {
|
|
62
|
-
case "gotenberg": return new GotenbergDocumentRenderProvider(auth, options);
|
|
63
46
|
case "cloudflare-browser": return new CloudflareBrowserDocumentRenderProvider(auth, options);
|
|
64
47
|
}
|
|
65
48
|
}
|
|
@@ -87,7 +70,7 @@ var DocumentRenderClient = class DocumentRenderClient {
|
|
|
87
70
|
const documentRenderPdfTool = defineTool({
|
|
88
71
|
id: "document-render-pdf",
|
|
89
72
|
name: "renderDocumentPdf",
|
|
90
|
-
description: "Create a PDF from HTML or a URL with a browser print engine and return the final ArtifactRef. Use for web layouts, reports, and invoices.
|
|
73
|
+
description: "Create a PDF from HTML or a URL with a browser print engine and return the final ArtifactRef. Use for web layouts, reports, and invoices. Do not use a general code sandbox to print HTML.",
|
|
91
74
|
inputSchema: renderPdfInputSchema,
|
|
92
75
|
outputSchema: renderOutputSchema,
|
|
93
76
|
sideEffect: "write",
|
|
@@ -133,7 +116,7 @@ const documentRenderScreenshotBatchTool = defineTool({
|
|
|
133
116
|
const documentRenderModule = defineModule({
|
|
134
117
|
id: "document-render",
|
|
135
118
|
title: "Document Render",
|
|
136
|
-
description: "Create final PDF or PNG ArtifactRefs from HTML or URLs with a browser renderer.
|
|
119
|
+
description: "Create final PDF or PNG ArtifactRefs from HTML or URLs with a browser renderer.",
|
|
137
120
|
runtime: "both",
|
|
138
121
|
auth: {
|
|
139
122
|
type: "custom",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["#client","#client","#ops"],"sources":["../../../src/modules/document-render/contracts.ts","../../../src/modules/document-render/providers/cloudflare-browser.ts","../../../src/modules/document-render/providers/gotenberg.ts","../../../src/modules/document-render/client.ts","../../../src/modules/document-render/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\nimport {\n\tcloudflareBrowserAuthSchema,\n\tcloudflareBrowserRenderOutputSchema,\n\tcloudflareBrowserRenderPdfInputSchema,\n\tcloudflareBrowserRenderScreenshotInputSchema\n} from '../../vendors/cloudflare-browser'\nimport {\n\tgotenbergAuthSchema,\n\tgotenbergRenderOutputSchema,\n\tgotenbergRenderPdfInputSchema,\n\tgotenbergRenderScreenshotInputSchema\n} from '../../vendors/gotenberg'\n\nexport const MAX_BATCH_RENDER = 10\n\nexport const gotenbergDocumentRenderAuthSchema = gotenbergAuthSchema.extend({\n\tprovider: z.literal('gotenberg')\n})\n\nexport const cloudflareBrowserDocumentRenderAuthSchema = cloudflareBrowserAuthSchema.extend({\n\tprovider: z.literal('cloudflare-browser')\n})\n\nexport type GotenbergDocumentRenderAuth = z.infer<typeof gotenbergDocumentRenderAuthSchema>\nexport type CloudflareBrowserDocumentRenderAuth = z.infer<typeof cloudflareBrowserDocumentRenderAuthSchema>\n\nexport const documentRenderAuthSchema = z.discriminatedUnion('provider', [\n\tgotenbergDocumentRenderAuthSchema,\n\tcloudflareBrowserDocumentRenderAuthSchema\n])\n\nexport type DocumentRenderAuth = z.infer<typeof documentRenderAuthSchema>\n\n/** Same I/O both render vendors accept (gotenberg schemas are the canonical seam shape). */\nexport const renderPdfInputSchema = gotenbergRenderPdfInputSchema\nexport const renderScreenshotInputSchema = gotenbergRenderScreenshotInputSchema\nexport const renderOutputSchema = gotenbergRenderOutputSchema\n\nexport const renderPdfBatchInputSchema = z.object({\n\titems: z.array(renderPdfInputSchema).min(1).max(MAX_BATCH_RENDER).describe('PDF render jobs (max 10)')\n})\n\nexport const renderScreenshotBatchInputSchema = z.object({\n\titems: z.array(renderScreenshotInputSchema).min(1).max(MAX_BATCH_RENDER).describe('Screenshot jobs (max 10)')\n})\n\nexport const renderPdfBatchOutputSchema = batchResultSchema(renderOutputSchema)\nexport const renderScreenshotBatchOutputSchema = batchResultSchema(renderOutputSchema)\n\nexport type RenderPdfInput = z.infer<typeof renderPdfInputSchema>\nexport type RenderScreenshotInput = z.infer<typeof renderScreenshotInputSchema>\nexport type RenderOutput = z.infer<typeof renderOutputSchema>\nexport type RenderPdfBatchInput = z.infer<typeof renderPdfBatchInputSchema>\nexport type RenderScreenshotBatchInput = z.infer<typeof renderScreenshotBatchInputSchema>\nexport type RenderPdfBatchOutput = z.infer<typeof renderPdfBatchOutputSchema>\nexport type RenderScreenshotBatchOutput = z.infer<typeof renderScreenshotBatchOutputSchema>\n\n// Re-export cloudflare schemas for type identity checks if needed\nexport {\n\tcloudflareBrowserRenderPdfInputSchema,\n\tcloudflareBrowserRenderScreenshotInputSchema,\n\tcloudflareBrowserRenderOutputSchema\n}\n\nexport type DocumentRenderOps = {\n\trenderPdf: (input: RenderPdfInput) => Promise<RenderOutput>\n\trenderScreenshot: (input: RenderScreenshotInput) => Promise<RenderOutput>\n}\n","/**\n * Cloudflare Browser provider for the document-render seam. Wraps `CloudflareBrowserClient`.\n */\n\nimport type { HttpServiceOptions } from '../../../transport/http-service'\nimport { CloudflareBrowserClient } from '../../../vendors/cloudflare-browser'\nimport type {\n\tCloudflareBrowserDocumentRenderAuth,\n\tDocumentRenderOps,\n\tRenderPdfInput,\n\tRenderScreenshotInput\n} from '../contracts'\n\nexport type CloudflareBrowserDocumentRenderProviderOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class CloudflareBrowserDocumentRenderProvider implements DocumentRenderOps {\n\treadonly #client: CloudflareBrowserClient\n\n\tconstructor(auth: CloudflareBrowserDocumentRenderAuth, options: CloudflareBrowserDocumentRenderProviderOptions = {}) {\n\t\tconst { provider: _p, ...vendorAuth } = auth\n\t\tthis.#client = new CloudflareBrowserClient(vendorAuth, options)\n\t}\n\n\trenderPdf(input: RenderPdfInput) {\n\t\treturn this.#client.renderPdf(input)\n\t}\n\n\trenderScreenshot(input: RenderScreenshotInput) {\n\t\treturn this.#client.renderScreenshot(input)\n\t}\n}\n","/**\n * Gotenberg provider for the document-render seam. Wraps `GotenbergClient`.\n */\n\nimport type { HttpServiceOptions } from '../../../transport/http-service'\nimport { GotenbergClient } from '../../../vendors/gotenberg'\nimport type {\n\tDocumentRenderOps,\n\tGotenbergDocumentRenderAuth,\n\tRenderPdfInput,\n\tRenderScreenshotInput\n} from '../contracts'\n\nexport type GotenbergDocumentRenderProviderOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class GotenbergDocumentRenderProvider implements DocumentRenderOps {\n\treadonly #client: GotenbergClient\n\n\tconstructor(auth: GotenbergDocumentRenderAuth, options: GotenbergDocumentRenderProviderOptions = {}) {\n\t\tconst { provider: _p, ...vendorAuth } = auth\n\t\tthis.#client = new GotenbergClient(vendorAuth, options)\n\t}\n\n\trenderPdf(input: RenderPdfInput) {\n\t\treturn this.#client.renderPdf(input)\n\t}\n\n\trenderScreenshot(input: RenderScreenshotInput) {\n\t\treturn this.#client.renderScreenshot(input)\n\t}\n}\n","/**\n * Document-render seam client — picks gotenberg / cloudflare-browser from host auth.\n */\n\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { documentRenderAuthSchema } from './contracts'\nimport type { DocumentRenderAuth, DocumentRenderOps, RenderPdfInput, RenderScreenshotInput } from './contracts'\nimport { CloudflareBrowserDocumentRenderProvider } from './providers/cloudflare-browser'\nimport { GotenbergDocumentRenderProvider } from './providers/gotenberg'\n\nfunction transportOptions(ctx: ToolContext) {\n\treturn {\n\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t...(ctx.signal && { signal: ctx.signal })\n\t}\n}\n\nfunction providerFor(auth: DocumentRenderAuth, ctx: ToolContext): DocumentRenderOps {\n\tconst options = transportOptions(ctx)\n\tswitch (auth.provider) {\n\t\tcase 'gotenberg':\n\t\t\treturn new GotenbergDocumentRenderProvider(auth, options)\n\t\tcase 'cloudflare-browser':\n\t\t\treturn new CloudflareBrowserDocumentRenderProvider(auth, options)\n\t}\n}\n\nexport class DocumentRenderClient implements DocumentRenderOps {\n\treadonly #ops: DocumentRenderOps\n\n\tconstructor(ops: DocumentRenderOps) {\n\t\tthis.#ops = ops\n\t}\n\n\tstatic fromContext(ctx: ToolContext): DocumentRenderClient {\n\t\tconst auth = requireAuth(ctx, documentRenderAuthSchema)\n\t\treturn new DocumentRenderClient(providerFor(auth, ctx))\n\t}\n\n\tstatic fromAuth(auth: DocumentRenderAuth, ctx: ToolContext = {}): DocumentRenderClient {\n\t\treturn new DocumentRenderClient(providerFor(auth, ctx))\n\t}\n\n\trenderPdf(input: RenderPdfInput) {\n\t\treturn this.#ops.renderPdf(input)\n\t}\n\n\trenderScreenshot(input: RenderScreenshotInput) {\n\t\treturn this.#ops.renderScreenshot(input)\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { runBatchItems } from '../../shared/batch'\nimport { DocumentRenderClient } from './client'\nimport {\n\tdocumentRenderAuthSchema,\n\trenderOutputSchema,\n\trenderPdfBatchInputSchema,\n\trenderPdfBatchOutputSchema,\n\trenderPdfInputSchema,\n\trenderScreenshotBatchInputSchema,\n\trenderScreenshotBatchOutputSchema,\n\trenderScreenshotInputSchema\n} from './contracts'\n\nexport type { DocumentRenderAuth } from './contracts'\nexport { documentRenderAuthSchema }\n\nexport const documentRenderPdfTool = defineTool({\n\tid: 'document-render-pdf',\n\tname: 'renderDocumentPdf',\n\tdescription:\n\t\t'Create a PDF from HTML or a URL with a browser print engine and return the final ArtifactRef. Use for web layouts, reports, and invoices. Use file-convert for an existing office document; do not use a general code sandbox to print HTML.',\n\tinputSchema: renderPdfInputSchema,\n\toutputSchema: renderOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => DocumentRenderClient.fromContext(ctx).renderPdf(input)\n})\n\nexport const documentRenderScreenshotTool = defineTool({\n\tid: 'document-render-screenshot',\n\tname: 'renderDocumentScreenshot',\n\tdescription:\n\t\t'Create a PNG screenshot ArtifactRef from HTML or a URL. Use when the requested deliverable is a rendered page image, not when interactive browsing or a source image transform is required.',\n\tinputSchema: renderScreenshotInputSchema,\n\toutputSchema: renderOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => DocumentRenderClient.fromContext(ctx).renderScreenshot(input)\n})\n\nexport const documentRenderPdfBatchTool = defineTool({\n\tid: 'document-render-pdf-batch',\n\tname: 'renderDocumentPdfBatch',\n\tdescription:\n\t\t'Create PDF ArtifactRefs from up to 10 HTML or URL sources. Use only when multiple independent browser-printed PDFs are required. Returns per-item success or error without aborting the batch.',\n\tinputSchema: renderPdfBatchInputSchema,\n\toutputSchema: renderPdfBatchOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => {\n\t\tconst client = DocumentRenderClient.fromContext(ctx)\n\t\treturn runBatchItems(input.items, async (item) => client.renderPdf(item))\n\t}\n})\n\nexport const documentRenderScreenshotBatchTool = defineTool({\n\tid: 'document-render-screenshot-batch',\n\tname: 'renderDocumentScreenshotBatch',\n\tdescription:\n\t\t'Create PNG screenshot ArtifactRefs from up to 10 HTML or URL sources. Use only when multiple independent page images are required. Returns per-item success or error without aborting the batch.',\n\tinputSchema: renderScreenshotBatchInputSchema,\n\toutputSchema: renderScreenshotBatchOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => {\n\t\tconst client = DocumentRenderClient.fromContext(ctx)\n\t\treturn runBatchItems(input.items, async (item) => client.renderScreenshot(item))\n\t}\n})\n\nexport const documentRenderModule = defineModule({\n\tid: 'document-render',\n\ttitle: 'Document Render',\n\tdescription:\n\t\t'Create final PDF or PNG ArtifactRefs from HTML or URLs with a browser renderer. Use file conversion for existing office documents.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: documentRenderAuthSchema },\n\tcategories: ['documents', 'render'],\n\tclassification: 'standard',\n\ttags: ['pdf', 'screenshot'],\n\ttools: [\n\t\tdocumentRenderPdfTool,\n\t\tdocumentRenderScreenshotTool,\n\t\tdocumentRenderPdfBatchTool,\n\t\tdocumentRenderScreenshotBatchTool\n\t]\n})\n"],"mappings":";;;;;;AAkBA,MAAa,oCAAoC,oBAAoB,OAAO,EAC3E,UAAU,EAAE,QAAQ,WAAW,EAChC,CAAC;AAED,MAAa,4CAA4C,4BAA4B,OAAO,EAC3F,UAAU,EAAE,QAAQ,oBAAoB,EACzC,CAAC;AAKD,MAAa,2BAA2B,EAAE,mBAAmB,YAAY,CACxE,mCACA,yCACD,CAAC;;AAKD,MAAa,uBAAuB;AACpC,MAAa,8BAA8B;AAC3C,MAAa,qBAAqB;AAElC,MAAa,4BAA4B,EAAE,OAAO,EACjD,OAAO,EAAE,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,EAAoB,CAAC,CAAC,SAAS,0BAA0B,EACtG,CAAC;AAED,MAAa,mCAAmC,EAAE,OAAO,EACxD,OAAO,EAAE,MAAM,2BAA2B,C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AAC;CAChF;AACD,CAAC;AAED,MAAa,uBAAuB,aAAa;CAChD,IAAI;CACJ,OAAO;CACP,aACC;CACD,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAyB;CACzD,YAAY,CAAC,aAAa,QAAQ;CAClC,gBAAgB;CAChB,MAAM,CAAC,OAAO,YAAY;CAC1B,OAAO;EACN;EACA;EACA;EACA;CACD;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["#client","#ops"],"sources":["../../../src/modules/document-render/contracts.ts","../../../src/modules/document-render/providers/cloudflare-browser.ts","../../../src/modules/document-render/client.ts","../../../src/modules/document-render/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\nimport {\n\tcloudflareBrowserAuthSchema,\n\tcloudflareBrowserRenderOutputSchema,\n\tcloudflareBrowserRenderPdfInputSchema,\n\tcloudflareBrowserRenderScreenshotInputSchema\n} from '../../vendors/cloudflare-browser'\n\nexport const MAX_BATCH_RENDER = 10\n\n/** Host auth: vendor credentials + provider discriminator. */\nexport const cloudflareBrowserDocumentRenderAuthSchema = cloudflareBrowserAuthSchema.extend({\n\tprovider: z.literal('cloudflare-browser')\n})\n\nexport type CloudflareBrowserDocumentRenderAuth = z.infer<typeof cloudflareBrowserDocumentRenderAuthSchema>\n\nexport const documentRenderAuthSchema = z.discriminatedUnion('provider', [cloudflareBrowserDocumentRenderAuthSchema])\n\nexport type DocumentRenderAuth = z.infer<typeof documentRenderAuthSchema>\n\n/** Capability I/O — re-export Cloudflare Browser shapes under seam names. */\nexport const renderPdfInputSchema = cloudflareBrowserRenderPdfInputSchema\nexport const renderScreenshotInputSchema = cloudflareBrowserRenderScreenshotInputSchema\nexport const renderOutputSchema = cloudflareBrowserRenderOutputSchema\n\nexport const renderPdfBatchInputSchema = z.object({\n\titems: z.array(renderPdfInputSchema).min(1).max(MAX_BATCH_RENDER).describe('PDF render jobs (max 10)')\n})\n\nexport const renderScreenshotBatchInputSchema = z.object({\n\titems: z.array(renderScreenshotInputSchema).min(1).max(MAX_BATCH_RENDER).describe('Screenshot jobs (max 10)')\n})\n\nexport const renderPdfBatchOutputSchema = batchResultSchema(renderOutputSchema)\nexport const renderScreenshotBatchOutputSchema = batchResultSchema(renderOutputSchema)\n\nexport type RenderPdfInput = z.infer<typeof renderPdfInputSchema>\nexport type RenderScreenshotInput = z.infer<typeof renderScreenshotInputSchema>\nexport type RenderOutput = z.infer<typeof renderOutputSchema>\nexport type RenderPdfBatchInput = z.infer<typeof renderPdfBatchInputSchema>\nexport type RenderScreenshotBatchInput = z.infer<typeof renderScreenshotBatchInputSchema>\nexport type RenderPdfBatchOutput = z.infer<typeof renderPdfBatchOutputSchema>\nexport type RenderScreenshotBatchOutput = z.infer<typeof renderScreenshotBatchOutputSchema>\n\nexport type DocumentRenderOps = {\n\trenderPdf: (input: RenderPdfInput) => Promise<RenderOutput>\n\trenderScreenshot: (input: RenderScreenshotInput) => Promise<RenderOutput>\n}\n","/**\n * Cloudflare Browser provider for the document-render seam. Wraps `CloudflareBrowserClient`.\n */\n\nimport type { HttpServiceOptions } from '../../../transport/http-service'\nimport { CloudflareBrowserClient } from '../../../vendors/cloudflare-browser'\nimport type {\n\tCloudflareBrowserDocumentRenderAuth,\n\tDocumentRenderOps,\n\tRenderPdfInput,\n\tRenderScreenshotInput\n} from '../contracts'\n\nexport type CloudflareBrowserDocumentRenderProviderOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class CloudflareBrowserDocumentRenderProvider implements DocumentRenderOps {\n\treadonly #client: CloudflareBrowserClient\n\n\tconstructor(auth: CloudflareBrowserDocumentRenderAuth, options: CloudflareBrowserDocumentRenderProviderOptions = {}) {\n\t\tconst { provider: _p, ...vendorAuth } = auth\n\t\tthis.#client = new CloudflareBrowserClient(vendorAuth, options)\n\t}\n\n\trenderPdf(input: RenderPdfInput) {\n\t\treturn this.#client.renderPdf(input)\n\t}\n\n\trenderScreenshot(input: RenderScreenshotInput) {\n\t\treturn this.#client.renderScreenshot(input)\n\t}\n}\n","/**\n * Document-render seam client — picks cloudflare-browser from host auth.\n */\n\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { documentRenderAuthSchema } from './contracts'\nimport type { DocumentRenderAuth, DocumentRenderOps, RenderPdfInput, RenderScreenshotInput } from './contracts'\nimport { CloudflareBrowserDocumentRenderProvider } from './providers/cloudflare-browser'\n\nfunction transportOptions(ctx: ToolContext) {\n\treturn {\n\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t...(ctx.signal && { signal: ctx.signal })\n\t}\n}\n\nfunction providerFor(auth: DocumentRenderAuth, ctx: ToolContext): DocumentRenderOps {\n\tconst options = transportOptions(ctx)\n\tswitch (auth.provider) {\n\t\tcase 'cloudflare-browser':\n\t\t\treturn new CloudflareBrowserDocumentRenderProvider(auth, options)\n\t}\n}\n\nexport class DocumentRenderClient implements DocumentRenderOps {\n\treadonly #ops: DocumentRenderOps\n\n\tconstructor(ops: DocumentRenderOps) {\n\t\tthis.#ops = ops\n\t}\n\n\tstatic fromContext(ctx: ToolContext): DocumentRenderClient {\n\t\tconst auth = requireAuth(ctx, documentRenderAuthSchema)\n\t\treturn new DocumentRenderClient(providerFor(auth, ctx))\n\t}\n\n\tstatic fromAuth(auth: DocumentRenderAuth, ctx: ToolContext = {}): DocumentRenderClient {\n\t\treturn new DocumentRenderClient(providerFor(auth, ctx))\n\t}\n\n\trenderPdf(input: RenderPdfInput) {\n\t\treturn this.#ops.renderPdf(input)\n\t}\n\n\trenderScreenshot(input: RenderScreenshotInput) {\n\t\treturn this.#ops.renderScreenshot(input)\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { runBatchItems } from '../../shared/batch'\nimport { DocumentRenderClient } from './client'\nimport {\n\tdocumentRenderAuthSchema,\n\trenderOutputSchema,\n\trenderPdfBatchInputSchema,\n\trenderPdfBatchOutputSchema,\n\trenderPdfInputSchema,\n\trenderScreenshotBatchInputSchema,\n\trenderScreenshotBatchOutputSchema,\n\trenderScreenshotInputSchema\n} from './contracts'\n\nexport type { DocumentRenderAuth } from './contracts'\nexport { documentRenderAuthSchema }\n\nexport const documentRenderPdfTool = defineTool({\n\tid: 'document-render-pdf',\n\tname: 'renderDocumentPdf',\n\tdescription:\n\t\t'Create a PDF from HTML or a URL with a browser print engine and return the final ArtifactRef. Use for web layouts, reports, and invoices. Do not use a general code sandbox to print HTML.',\n\tinputSchema: renderPdfInputSchema,\n\toutputSchema: renderOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => DocumentRenderClient.fromContext(ctx).renderPdf(input)\n})\n\nexport const documentRenderScreenshotTool = defineTool({\n\tid: 'document-render-screenshot',\n\tname: 'renderDocumentScreenshot',\n\tdescription:\n\t\t'Create a PNG screenshot ArtifactRef from HTML or a URL. Use when the requested deliverable is a rendered page image, not when interactive browsing or a source image transform is required.',\n\tinputSchema: renderScreenshotInputSchema,\n\toutputSchema: renderOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => DocumentRenderClient.fromContext(ctx).renderScreenshot(input)\n})\n\nexport const documentRenderPdfBatchTool = defineTool({\n\tid: 'document-render-pdf-batch',\n\tname: 'renderDocumentPdfBatch',\n\tdescription:\n\t\t'Create PDF ArtifactRefs from up to 10 HTML or URL sources. Use only when multiple independent browser-printed PDFs are required. Returns per-item success or error without aborting the batch.',\n\tinputSchema: renderPdfBatchInputSchema,\n\toutputSchema: renderPdfBatchOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => {\n\t\tconst client = DocumentRenderClient.fromContext(ctx)\n\t\treturn runBatchItems(input.items, async (item) => client.renderPdf(item))\n\t}\n})\n\nexport const documentRenderScreenshotBatchTool = defineTool({\n\tid: 'document-render-screenshot-batch',\n\tname: 'renderDocumentScreenshotBatch',\n\tdescription:\n\t\t'Create PNG screenshot ArtifactRefs from up to 10 HTML or URL sources. Use only when multiple independent page images are required. Returns per-item success or error without aborting the batch.',\n\tinputSchema: renderScreenshotBatchInputSchema,\n\toutputSchema: renderScreenshotBatchOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => {\n\t\tconst client = DocumentRenderClient.fromContext(ctx)\n\t\treturn runBatchItems(input.items, async (item) => client.renderScreenshot(item))\n\t}\n})\n\nexport const documentRenderModule = defineModule({\n\tid: 'document-render',\n\ttitle: 'Document Render',\n\tdescription: 'Create final PDF or PNG ArtifactRefs from HTML or URLs with a browser renderer.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: documentRenderAuthSchema },\n\tcategories: ['documents', 'render'],\n\tclassification: 'standard',\n\ttags: ['pdf', 'screenshot'],\n\ttools: [\n\t\tdocumentRenderPdfTool,\n\t\tdocumentRenderScreenshotTool,\n\t\tdocumentRenderPdfBatchTool,\n\t\tdocumentRenderScreenshotBatchTool\n\t]\n})\n"],"mappings":";;;;;;AAaA,MAAa,4CAA4C,4BAA4B,OAAO,EAC3F,UAAU,EAAE,QAAQ,oBAAoB,EACzC,CAAC;AAID,MAAa,2BAA2B,EAAE,mBAAmB,YAAY,CAAC,yCAAyC,CAAC;;AAKpH,MAAa,uBAAuB;AACpC,MAAa,8BAA8B;AAC3C,MAAa,qBAAqB;AAElC,MAAa,4BAA4B,EAAE,OAAO,EACjD,OAAO,EAAE,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,EAAoB,CAAC,CAAC,SAAS,0BAA0B,EACtG,CAAC;AAED,MAAa,mCAAmC,EAAE,OAAO,EACxD,OAAO,EAAE,MAAM,2BAA2B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,EAAoB,CAAC,CAAC,SAAS,0BAA0B,EAC7G,CAAC;AAED,MAAa,6BAA6B,kBAAkB,kBAAkB;AAC9E,MAAa,oCAAoC,kBAAkB,kBAAkB;;;ACtBrF,IAAa,0CAAb,MAAkF;CACjF;CAEA,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,WAAW;CACtD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,qBAAqB,YAAY,GAAG,CAAC,CAAC,iBAAiB,KAAK;AAC5F,CAAC;AAED,MAAa,6BAA6B,WAAW;CACpD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ;EAC9B,MAAM,SAAS,qBAAqB,YAAY,GAAG;EACnD,OAAO,cAAc,MAAM,OAAO,OAAO,SAAS,OAAO,UAAU,IAAI,CAAC;CACzE;AACD,CAAC;AAED,MAAa,oCAAoC,WAAW;CAC3D,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ;EAC9B,MAAM,SAAS,qBAAqB,YAAY,GAAG;EACnD,OAAO,cAAc,MAAM,OAAO,OAAO,SAAS,OAAO,iBAAiB,IAAI,CAAC;CAChF;AACD,CAAC;AAED,MAAa,uBAAuB,aAAa;CAChD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAyB;CACzD,YAAY,CAAC,aAAa,QAAQ;CAClC,gBAAgB;CAChB,MAAM,CAAC,OAAO,YAAY;CAC1B,OAAO;EACN;EACA;EACA;EACA;CACD;AACD,CAAC"}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import { a as ModuleDefinition, o as ToolContext, s as ToolDefinition } from "../../types-Ccb0DXY9.js";
|
|
2
2
|
import "../../index-CZX5OeOF.js";
|
|
3
3
|
import { s as HttpServiceOptions } from "../../http-service-CerzWwQO.js";
|
|
4
|
-
import { t as BatchResult } from "../../batch-BMM5dXqL.js";
|
|
5
4
|
import { a as namedAddressSchema, i as attachmentSchema, n as MAX_EMAIL_BYTES, r as NamedAddress, t as MAX_BATCH_EMAILS } from "../../index-CLmTrcu5.js";
|
|
6
5
|
import "../../index-C-Cuh9it.js";
|
|
7
6
|
import { z } from "zod";
|
|
7
|
+
//#region src/shared/batch.d.ts
|
|
8
|
+
declare const batchItemErrorSchema: z.ZodObject<{
|
|
9
|
+
code: z.ZodString;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type BatchItemError = z.infer<typeof batchItemErrorSchema>;
|
|
14
|
+
type BatchItemResult<TValue> = {
|
|
15
|
+
index: number;
|
|
16
|
+
ok: boolean;
|
|
17
|
+
value?: TValue;
|
|
18
|
+
error?: BatchItemError;
|
|
19
|
+
};
|
|
20
|
+
type BatchResult<TValue> = {
|
|
21
|
+
results: Array<BatchItemResult<TValue>>;
|
|
22
|
+
succeeded: number;
|
|
23
|
+
failed: number;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
8
26
|
//#region src/modules/email/contracts.d.ts
|
|
9
27
|
declare const emailSenderSchema: z.ZodUnion<readonly [z.ZodEmail, z.ZodObject<{
|
|
10
28
|
email: z.ZodEmail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/modules/email/contracts.ts","../../../src/modules/email/client.ts","../../../src/modules/email/module.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/shared/batch.ts","../../../src/modules/email/contracts.ts","../../../src/modules/email/client.ts","../../../src/modules/email/module.ts"],"mappings":";;;;;;;cAOa,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;KAEU,iBAAiB,EAAE,aAAa;KAEhC,gBAAgB;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;;KAGG,YAAY;EACvB,SAAS,MAAM,gBAAgB;EAC/B;EACA;;;;cCJY,mBAAiB,EAAA,mBAAA,EAAA,UAAA,EAAA;;;GAE7B,EAAA,KAAA;;cAGY,uBAAqB,EAAA;;;;;;;GAGhC,EAAA,KAAA;cAEW,+BAA6B,EAAA;;;;;;;;GAGxC,EAAA,KAAA;KAEU,kBAAkB,EAAE,aAAa;KACjC,0BAA0B,EAAE,aAAa;cAExC,iBAAe,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;GAA2F,EAAA,KAAA;KAE3G,YAAY,EAAE,aAAa;;cAK1B,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI9B,EAAA,KAAA;KACS,iBAAiB,EAAE,aAAa;;;;;cAO/B,uBAAqB,EAAA;;;;;GAKhC,EAAA,KAAA;cAEW,2BAAyB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEpC,EAAA,KAAA;cAEW,4BAA0B,EAAA;;;;;;;;;;;;;;;;;;GAA2C,EAAA,KAAA;KAEtE,kBAAkB,EAAE,aAAa;KACjC,sBAAsB,EAAE,aAAa;KACrC,uBAAuB,EAAE,aAAa;;KAGtC;EACX,OAAO,OAAO,mBAAmB,QAAQ;EACzC,YAAY,OAAO,wBAAwB,QAAQ;;;;KCzDxC,qBAAqB,KAAK;cAgCzB,uBAAuB;;EAInC,YAAY,MAAM,WAAW,UAAS;SAK/B,YAAY,KAAK,cAAc;SAK/B,SAAS,MAAM,WAAW,MAAK,cAAmB;EAInD,KAAK,OAAO,iBAAc;;;;;;EAQhC,UAAU,OAAO,sBAAmB,QAAnB;;;;;;;;;cClEL,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAYA,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAYA,aAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as isToolError, t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
2
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
2
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
3
3
|
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
4
4
|
import { n as runBatchItems, t as batchResultSchema } from "../../batch-Co1ujeAW.js";
|
|
5
5
|
import { a as attachmentSchema, i as MAX_EMAIL_BYTES, o as namedAddressSchema, r as MAX_BATCH_EMAILS } from "../../limits-hjrO8zUG.js";
|
|
6
|
-
import { a as cloudflareEmailAuthSchema, i as CloudflareEmailClient } from "../../cloudflare-email-
|
|
7
|
-
import { a as resendAuthSchema, c as resendSendInputSchema, i as ResendClient } from "../../resend-
|
|
6
|
+
import { a as cloudflareEmailAuthSchema, i as CloudflareEmailClient } from "../../cloudflare-email-CSRq8mRd.js";
|
|
7
|
+
import { a as resendAuthSchema, c as resendSendInputSchema, i as ResendClient } from "../../resend-Bu0NFO3h.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
//#region src/modules/email/contracts.ts
|
|
10
10
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
2
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
2
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
3
3
|
import { n as bytesToBase64, o as utf8ToBytes, t as base64ToBytes } from "../../bytes-BxpimpQx.js";
|
|
4
4
|
import { isNil, isPlainObject, isString } from "es-toolkit";
|
|
5
5
|
import { castArray, has, isArray } from "es-toolkit/compat";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
2
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
2
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
3
3
|
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
4
4
|
import { t as artifactRefSchema } from "../../artifact-D064mHfK.js";
|
|
5
5
|
import { n as bytesToBase64, r as bytesToUtf8 } from "../../bytes-BxpimpQx.js";
|
|
6
|
-
import { m as s3AuthSchema, p as S3Client } from "../../s3-
|
|
6
|
+
import { m as s3AuthSchema, p as S3Client } from "../../s3-Dj7Teh-A.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/modules/files/contracts.ts
|
|
9
9
|
/** Max bytes for a single range read through files tools. */
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { a as ModuleDefinition, o as ToolContext, s as ToolDefinition } from "../../types-Ccb0DXY9.js";
|
|
2
2
|
import "../../index-CZX5OeOF.js";
|
|
3
|
-
import {
|
|
3
|
+
import { g as S3ClientOptions } from "../../index-ByHp3nZm.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
//#region src/shared/object-artifact-store.d.ts
|
|
6
|
+
type ObjectArtifactStoreOptions = S3ClientOptions;
|
|
7
|
+
//#endregion
|
|
5
8
|
//#region src/modules/image/contracts.d.ts
|
|
6
9
|
declare const MAX_IMAGE_BYTES: number;
|
|
7
10
|
declare const MAX_IMAGE_DIMENSION = 16384;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/modules/image/contracts.ts","../../../src/modules/image/client.ts","../../../src/modules/image/module.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/shared/object-artifact-store.ts","../../../src/modules/image/contracts.ts","../../../src/modules/image/client.ts","../../../src/modules/image/module.ts"],"mappings":";;;;;KAMY,6BAA6B;;;cCD5B;cACA;cAEA,iBAAe,EAAA;;;;;;;;;;GAE1B,EAAA,KAAA;cAQW,0BAAwB,EAAA;;;;;;;;;;;GAAuB,EAAA,KAAA;cAE/C,qBAAmB,EAAA;;;;;;;;;;GAU9B,EAAA,KAAA;cAEW,4BAA0B,EAAA;;;;;;;;;;;;;;;;;;;;;;GAGrC,EAAA,KAAA;cAEW,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;GAgBhC,EAAA,KAAA;cAEU,sBAAoB,EAAA;;;;;;;;;;;;;;;;;GAQ/B,EAAA,KAAA;cAEW,2BAAyB,EAAA;;;;;;;;;;;;;;;GAMpC,EAAA,KAAA;cAEW,mBAAiB,EAAA;;;;;;;;cAEjB,yBAAuB,EAAA;;;;;;;;;;;;;;;;;;;;;;GAMlC,EAAA,KAAA;KAEU,YAAY,EAAE,aAAa;KAC3B,qBAAqB,EAAE,aAAa;KACpC,gBAAgB,EAAE,aAAa;KAC/B,mBAAmB,EAAE,aAAa;KAClC,iBAAiB,EAAE,aAAa;KAChC,sBAAsB,EAAE,aAAa;KACrC,oBAAoB,EAAE,aAAa;KACnC,uBAAuB,EAAE,aAAa;;;KCrEtC,qBAAqB;cAoBpB;;EAGZ,YAAY,MAAM,WAAW,UAAS;SAW/B,YAAY,KAAK,cAAc;SAO/B,SAAS,MAAM,WAAW,UAAS,qBAA0B;EAI9D,SAAS,OAAO,qBAAqB,QAAQ;EAQ7C,OAAO,OAAO,mBAAmB,QAAQ;EAYzC,KAAK,OAAO,iBAAiB,QAAQ;EAYrC,UAAU,OAAO,sBAAsB,QAAQ;EAO/C,QAAQ,OAAO,oBAAoB,QAAQ;;;;cC5FrC,mBAAA;;;;;;;;;;;;;;;;;;;cAaA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaA,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaA,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaA,kBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaA,aAAA"}
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
2
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
2
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
3
3
|
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
4
4
|
import { t as artifactRefSchema } from "../../artifact-D064mHfK.js";
|
|
5
|
-
import { m as s3AuthSchema } from "../../s3-
|
|
6
|
-
import { n as extensionFromMediaType, r as mediaTypeFromPath } from "../../content-type-
|
|
7
|
-
import { t as ObjectArtifactStore } from "../../object-artifact-store-wZ2j9cto.js";
|
|
5
|
+
import { m as s3AuthSchema, p as S3Client } from "../../s3-Dj7Teh-A.js";
|
|
6
|
+
import { n as extensionFromMediaType, r as mediaTypeFromPath } from "../../content-type-E4_Qdoa0.js";
|
|
8
7
|
import { z } from "zod";
|
|
9
8
|
import sharp from "sharp";
|
|
9
|
+
//#region src/shared/object-artifact-store.ts
|
|
10
|
+
var ObjectArtifactStore = class {
|
|
11
|
+
#storage;
|
|
12
|
+
constructor(auth, options = {}) {
|
|
13
|
+
this.#storage = new S3Client(auth, options);
|
|
14
|
+
}
|
|
15
|
+
async read(source, maxBytes) {
|
|
16
|
+
if (source.store !== "object") throw new ToolError("This operation requires an object-store artifact", { code: "bad_input" });
|
|
17
|
+
return this.#storage.getBytes(source.key, { maxBytes });
|
|
18
|
+
}
|
|
19
|
+
async write(key, bytes, mediaType, filename) {
|
|
20
|
+
await this.#storage.putBytes(key, bytes, mediaType);
|
|
21
|
+
return artifactRefSchema.parse({
|
|
22
|
+
store: "object",
|
|
23
|
+
key,
|
|
24
|
+
media_type: mediaType,
|
|
25
|
+
filename,
|
|
26
|
+
byte_length: bytes.byteLength
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
10
31
|
//#region src/modules/image/contracts.ts
|
|
11
32
|
const MAX_IMAGE_BYTES = 50 * 1024 * 1024;
|
|
12
33
|
const MAX_IMAGE_DIMENSION = 16384;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["#artifacts","#read","#write"],"sources":["../../../src/modules/image/contracts.ts","../../../src/modules/image/client.ts","../../../src/modules/image/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { artifactRefSchema } from '../../shared/artifact'\nimport { s3AuthSchema } from '../../vendors/s3'\n\nexport const MAX_IMAGE_BYTES = 50 * 1024 * 1024\nexport const MAX_IMAGE_DIMENSION = 16_384\n\nexport const imageAuthSchema = z.object({\n\tstorage: s3AuthSchema.describe('Object storage for source and output image artifacts')\n})\n\nconst source = artifactRefSchema.describe('Source image artifact')\nconst outputKey = z.string().min(1).max(1_024).describe('Destination object key')\nconst filename = z.string().min(1).max(512).optional().describe('Display filename for the output image')\nconst dimension = z.int().min(1).max(MAX_IMAGE_DIMENSION)\nconst quality = z.int().min(1).max(100).optional().describe('Encoder quality from 1 to 100')\n\nexport const imageMetadataInputSchema = z.object({ source })\n\nexport const imageMetadataSchema = z.object({\n\tformat: z.string(),\n\tmedia_type: z.string().optional(),\n\twidth: z.int().positive(),\n\theight: z.int().positive(),\n\tspace: z.string(),\n\tchannels: z.int().positive(),\n\tdensity: z.number().positive().optional(),\n\thas_alpha: z.boolean(),\n\tpages: z.int().positive().optional()\n})\n\nexport const imageTransformOutputSchema = z.object({\n\tresult: artifactRefSchema.describe('Written image artifact'),\n\timage: imageMetadataSchema\n})\n\nexport const imageResizeInputSchema = z\n\t.object({\n\t\tsource,\n\t\twidth: dimension.optional().describe('Target width in pixels'),\n\t\theight: dimension.optional().describe('Target height in pixels'),\n\t\tfit: z\n\t\t\t.enum(['cover', 'contain', 'fill', 'inside', 'outside'])\n\t\t\t.optional()\n\t\t\t.describe('How the image fits the target box'),\n\t\twithout_enlargement: z.boolean().optional().describe('Prevent enlarging smaller images'),\n\t\toutput_key: outputKey,\n\t\tfilename\n\t})\n\t.refine((input) => input.width !== undefined || input.height !== undefined, {\n\t\tmessage: 'width or height is required',\n\t\tpath: ['width']\n\t})\n\nexport const imageCropInputSchema = z.object({\n\tsource,\n\tleft: z.int().min(0).describe('Left edge in pixels'),\n\ttop: z.int().min(0).describe('Top edge in pixels'),\n\twidth: dimension.describe('Crop width in pixels'),\n\theight: dimension.describe('Crop height in pixels'),\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport const imageThumbnailInputSchema = z.object({\n\tsource,\n\twidth: dimension.describe('Maximum thumbnail width in pixels'),\n\theight: dimension.describe('Maximum thumbnail height in pixels'),\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport const imageFormatSchema = z.enum(['jpeg', 'png', 'webp', 'avif', 'tiff', 'gif'])\n\nexport const imageConvertInputSchema = z.object({\n\tsource,\n\tformat: imageFormatSchema.describe('Destination image format'),\n\tquality,\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport type ImageAuth = z.infer<typeof imageAuthSchema>\nexport type ImageMetadataInput = z.infer<typeof imageMetadataInputSchema>\nexport type ImageMetadata = z.infer<typeof imageMetadataSchema>\nexport type ImageResizeInput = z.infer<typeof imageResizeInputSchema>\nexport type ImageCropInput = z.infer<typeof imageCropInputSchema>\nexport type ImageThumbnailInput = z.infer<typeof imageThumbnailInputSchema>\nexport type ImageConvertInput = z.infer<typeof imageConvertInputSchema>\nexport type ImageTransformOutput = z.infer<typeof imageTransformOutputSchema>\n","import sharp from 'sharp'\nimport type { Sharp } from 'sharp'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { extensionFromMediaType, mediaTypeFromPath } from '../../shared/content-type'\nimport { ObjectArtifactStore } from '../../shared/object-artifact-store'\nimport type { ObjectArtifactStoreOptions } from '../../shared/object-artifact-store'\nimport type {\n\tImageAuth,\n\tImageConvertInput,\n\tImageCropInput,\n\tImageMetadata,\n\tImageMetadataInput,\n\tImageResizeInput,\n\tImageThumbnailInput,\n\tImageTransformOutput\n} from './contracts'\nimport { MAX_IMAGE_BYTES, imageAuthSchema, imageMetadataSchema, imageTransformOutputSchema } from './contracts'\n\nexport type ImageClientOptions = ObjectArtifactStoreOptions\n\nfunction mediaTypeFor(extension: string): string {\n\treturn mediaTypeFromPath(`image.${extension}`) ?? 'application/octet-stream'\n}\n\nfunction mapMetadata(metadata: Awaited<ReturnType<Sharp['metadata']>>): ImageMetadata {\n\treturn imageMetadataSchema.parse({\n\t\tformat: metadata.format,\n\t\tmedia_type: metadata.mediaType,\n\t\twidth: metadata.width,\n\t\theight: metadata.height,\n\t\tspace: metadata.space,\n\t\tchannels: metadata.channels,\n\t\tdensity: metadata.density,\n\t\thas_alpha: metadata.hasAlpha,\n\t\tpages: metadata.pages\n\t})\n}\n\nexport class ImageClient {\n\treadonly #artifacts: ObjectArtifactStore\n\n\tconstructor(auth: ImageAuth, options: ImageClientOptions = {}) {\n\t\tconst parsed = imageAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid image auth credentials', {\n\t\t\t\tcode: 'bad_auth',\n\t\t\t\tdetails: { issues: parsed.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\t\tthis.#artifacts = new ObjectArtifactStore(parsed.data.storage, options)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): ImageClient {\n\t\treturn new ImageClient(requireAuth(ctx, imageAuthSchema), {\n\t\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t\t...(ctx.signal && { signal: ctx.signal })\n\t\t})\n\t}\n\n\tstatic fromAuth(auth: ImageAuth, options: ImageClientOptions = {}): ImageClient {\n\t\treturn new ImageClient(auth, options)\n\t}\n\n\tasync metadata(input: ImageMetadataInput): Promise<ImageMetadata> {\n\t\ttry {\n\t\t\treturn mapMetadata(await sharp(await this.#read(input.source)).metadata())\n\t\t} catch (error) {\n\t\t\tthrow new ToolError('Failed to inspect image', { code: 'bad_input', cause: error })\n\t\t}\n\t}\n\n\tasync resize(input: ImageResizeInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.resize({\n\t\t\t\twidth: input.width,\n\t\t\t\theight: input.height,\n\t\t\t\tfit: input.fit,\n\t\t\t\twithoutEnlargement: input.without_enlargement\n\t\t\t})\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync crop(input: ImageCropInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.extract({\n\t\t\t\tleft: input.left,\n\t\t\t\ttop: input.top,\n\t\t\t\twidth: input.width,\n\t\t\t\theight: input.height\n\t\t\t})\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync thumbnail(input: ImageThumbnailInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.resize(input.width, input.height, { fit: 'inside', withoutEnlargement: true })\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync convert(input: ImageConvertInput): Promise<ImageTransformOutput> {\n\t\tlet pipeline = sharp(await this.#read(input.source)).autoOrient()\n\t\tswitch (input.format) {\n\t\t\tcase 'jpeg':\n\t\t\t\tpipeline = pipeline.jpeg({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'png':\n\t\t\t\tpipeline = pipeline.png({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'webp':\n\t\t\t\tpipeline = pipeline.webp({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'avif':\n\t\t\t\tpipeline = pipeline.avif({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'tiff':\n\t\t\t\tpipeline = pipeline.tiff({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'gif':\n\t\t\t\tpipeline = pipeline.gif({ effort: input.quality ? Math.max(1, Math.round(input.quality / 10)) : undefined })\n\t\t}\n\t\treturn this.#write(pipeline, input.output_key, input.filename, input.format)\n\t}\n\n\tasync #read(source: ImageMetadataInput['source']): Promise<Uint8Array> {\n\t\treturn this.#artifacts.read(source, MAX_IMAGE_BYTES)\n\t}\n\n\tasync #write(\n\t\tpipeline: Sharp,\n\t\tkey: string,\n\t\tfilename?: string,\n\t\trequestedExtension?: string\n\t): Promise<ImageTransformOutput> {\n\t\ttry {\n\t\t\tconst { data, info } = await pipeline.toBuffer({ resolveWithObject: true })\n\t\t\tconst extension = requestedExtension ?? info.format\n\t\t\tconst mediaType = mediaTypeFor(extension)\n\t\t\tconst displayName = filename ?? `image.${extensionFromMediaType(mediaType) ?? extension}`\n\t\t\tconst result = await this.#artifacts.write(key, data, mediaType, displayName)\n\t\t\tconst image = mapMetadata(await sharp(data).metadata())\n\t\t\treturn imageTransformOutputSchema.parse({ result, image })\n\t\t} catch (error) {\n\t\t\tthrow new ToolError('Failed to transform image', { code: 'bad_input', cause: error })\n\t\t}\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { ImageClient } from './client'\nimport {\n\timageAuthSchema,\n\timageConvertInputSchema,\n\timageCropInputSchema,\n\timageMetadataInputSchema,\n\timageMetadataSchema,\n\timageResizeInputSchema,\n\timageThumbnailInputSchema,\n\timageTransformOutputSchema\n} from './contracts'\n\nexport const imageMetadataTool = defineTool({\n\tid: 'image-metadata',\n\tname: 'inspectImage',\n\tdescription:\n\t\t'Inspect an image artifact and return decoded format, dimensions, color space, channels, and page metadata.',\n\tinputSchema: imageMetadataInputSchema,\n\toutputSchema: imageMetadataSchema,\n\tsideEffect: 'read',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).metadata(input)\n})\n\nexport const imageResizeTool = defineTool({\n\tid: 'image-resize',\n\tname: 'resizeImage',\n\tdescription:\n\t\t'Resize an existing image ArtifactRef to a target width, height, or bounding box while preserving its format. Returns a final image ArtifactRef; use for exact resize requirements rather than general code or document tools.',\n\tinputSchema: imageResizeInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).resize(input)\n})\n\nexport const imageCropTool = defineTool({\n\tid: 'image-crop',\n\tname: 'cropImage',\n\tdescription:\n\t\t'Crop a rectangular pixel region from an existing image ArtifactRef and return a new image ArtifactRef. Use when the crop coordinates are known.',\n\tinputSchema: imageCropInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).crop(input)\n})\n\nexport const imageThumbnailTool = defineTool({\n\tid: 'image-thumbnail',\n\tname: 'createImageThumbnail',\n\tdescription:\n\t\t'Create a thumbnail ArtifactRef that fits within the requested dimensions without enlarging smaller images. Use for previews; use image-resize when exact output dimensions matter.',\n\tinputSchema: imageThumbnailInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).thumbnail(input)\n})\n\nexport const imageConvertTool = defineTool({\n\tid: 'image-convert',\n\tname: 'convertImage',\n\tdescription:\n\t\t'Re-encode an existing image ArtifactRef as JPEG, PNG, WebP, AVIF, TIFF, or GIF and return a new ArtifactRef. Use only when the required output image format differs from the source.',\n\tinputSchema: imageConvertInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).convert(input)\n})\n\nexport const imageModule = defineModule({\n\tid: 'image',\n\ttitle: 'Image',\n\tdescription: 'Inspect, resize, crop, thumbnail, and re-encode image artifacts.',\n\truntime: 'node',\n\tauth: { type: 'custom', schema: imageAuthSchema },\n\tcategories: ['media', 'image'],\n\tclassification: 'standard',\n\ttags: ['resize', 'convert'],\n\ttools: [imageMetadataTool, imageResizeTool, imageCropTool, imageThumbnailTool, imageConvertTool]\n})\n"],"mappings":";;;;;;;;;;AAKA,MAAa,kBAAkB,KAAK,OAAO;AAC3C,MAAa,sBAAsB;AAEnC,MAAa,kBAAkB,EAAE,OAAO,EACvC,SAAS,aAAa,SAAS,sDAAsD,EACtF,CAAC;AAED,MAAM,SAAS,kBAAkB,SAAS,uBAA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;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,SAAS,OAAO,OAAO,QAAQ,YAAY,YAAY,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1E,CAAC;AAED,MAAa,cAAc,aAAa;CACvC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAgB;CAChD,YAAY,CAAC,SAAS,OAAO;CAC7B,gBAAgB;CAChB,MAAM,CAAC,UAAU,SAAS;CAC1B,OAAO;EAAC;EAAmB;EAAiB;EAAe;EAAoB;CAAgB;AAChG,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["#storage","#artifacts","#read","#write"],"sources":["../../../src/shared/object-artifact-store.ts","../../../src/modules/image/contracts.ts","../../../src/modules/image/client.ts","../../../src/modules/image/module.ts"],"sourcesContent":["import { ToolError } from '../core/errors'\nimport type { ArtifactRef } from './artifact'\nimport { artifactRefSchema } from './artifact'\nimport { S3Client } from '../vendors/s3'\nimport type { S3Auth, S3ClientOptions } from '../vendors/s3'\n\nexport type ObjectArtifactStoreOptions = S3ClientOptions\n\nexport class ObjectArtifactStore {\n\treadonly #storage: S3Client\n\n\tconstructor(auth: S3Auth, options: ObjectArtifactStoreOptions = {}) {\n\t\tthis.#storage = new S3Client(auth, options)\n\t}\n\n\tasync read(source: ArtifactRef, maxBytes: number): Promise<Uint8Array> {\n\t\tif (source.store !== 'object') {\n\t\t\tthrow new ToolError('This operation requires an object-store artifact', { code: 'bad_input' })\n\t\t}\n\t\treturn this.#storage.getBytes(source.key, { maxBytes })\n\t}\n\n\tasync write(key: string, bytes: Uint8Array, mediaType: string, filename: string): Promise<ArtifactRef> {\n\t\tawait this.#storage.putBytes(key, bytes, mediaType)\n\t\treturn artifactRefSchema.parse({\n\t\t\tstore: 'object',\n\t\t\tkey,\n\t\t\tmedia_type: mediaType,\n\t\t\tfilename,\n\t\t\tbyte_length: bytes.byteLength\n\t\t})\n\t}\n}\n","import { z } from 'zod'\n\nimport { artifactRefSchema } from '../../shared/artifact'\nimport { s3AuthSchema } from '../../vendors/s3'\n\nexport const MAX_IMAGE_BYTES = 50 * 1024 * 1024\nexport const MAX_IMAGE_DIMENSION = 16_384\n\nexport const imageAuthSchema = z.object({\n\tstorage: s3AuthSchema.describe('Object storage for source and output image artifacts')\n})\n\nconst source = artifactRefSchema.describe('Source image artifact')\nconst outputKey = z.string().min(1).max(1_024).describe('Destination object key')\nconst filename = z.string().min(1).max(512).optional().describe('Display filename for the output image')\nconst dimension = z.int().min(1).max(MAX_IMAGE_DIMENSION)\nconst quality = z.int().min(1).max(100).optional().describe('Encoder quality from 1 to 100')\n\nexport const imageMetadataInputSchema = z.object({ source })\n\nexport const imageMetadataSchema = z.object({\n\tformat: z.string(),\n\tmedia_type: z.string().optional(),\n\twidth: z.int().positive(),\n\theight: z.int().positive(),\n\tspace: z.string(),\n\tchannels: z.int().positive(),\n\tdensity: z.number().positive().optional(),\n\thas_alpha: z.boolean(),\n\tpages: z.int().positive().optional()\n})\n\nexport const imageTransformOutputSchema = z.object({\n\tresult: artifactRefSchema.describe('Written image artifact'),\n\timage: imageMetadataSchema\n})\n\nexport const imageResizeInputSchema = z\n\t.object({\n\t\tsource,\n\t\twidth: dimension.optional().describe('Target width in pixels'),\n\t\theight: dimension.optional().describe('Target height in pixels'),\n\t\tfit: z\n\t\t\t.enum(['cover', 'contain', 'fill', 'inside', 'outside'])\n\t\t\t.optional()\n\t\t\t.describe('How the image fits the target box'),\n\t\twithout_enlargement: z.boolean().optional().describe('Prevent enlarging smaller images'),\n\t\toutput_key: outputKey,\n\t\tfilename\n\t})\n\t.refine((input) => input.width !== undefined || input.height !== undefined, {\n\t\tmessage: 'width or height is required',\n\t\tpath: ['width']\n\t})\n\nexport const imageCropInputSchema = z.object({\n\tsource,\n\tleft: z.int().min(0).describe('Left edge in pixels'),\n\ttop: z.int().min(0).describe('Top edge in pixels'),\n\twidth: dimension.describe('Crop width in pixels'),\n\theight: dimension.describe('Crop height in pixels'),\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport const imageThumbnailInputSchema = z.object({\n\tsource,\n\twidth: dimension.describe('Maximum thumbnail width in pixels'),\n\theight: dimension.describe('Maximum thumbnail height in pixels'),\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport const imageFormatSchema = z.enum(['jpeg', 'png', 'webp', 'avif', 'tiff', 'gif'])\n\nexport const imageConvertInputSchema = z.object({\n\tsource,\n\tformat: imageFormatSchema.describe('Destination image format'),\n\tquality,\n\toutput_key: outputKey,\n\tfilename\n})\n\nexport type ImageAuth = z.infer<typeof imageAuthSchema>\nexport type ImageMetadataInput = z.infer<typeof imageMetadataInputSchema>\nexport type ImageMetadata = z.infer<typeof imageMetadataSchema>\nexport type ImageResizeInput = z.infer<typeof imageResizeInputSchema>\nexport type ImageCropInput = z.infer<typeof imageCropInputSchema>\nexport type ImageThumbnailInput = z.infer<typeof imageThumbnailInputSchema>\nexport type ImageConvertInput = z.infer<typeof imageConvertInputSchema>\nexport type ImageTransformOutput = z.infer<typeof imageTransformOutputSchema>\n","import sharp from 'sharp'\nimport type { Sharp } from 'sharp'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { extensionFromMediaType, mediaTypeFromPath } from '../../shared/content-type'\nimport { ObjectArtifactStore } from '../../shared/object-artifact-store'\nimport type { ObjectArtifactStoreOptions } from '../../shared/object-artifact-store'\nimport type {\n\tImageAuth,\n\tImageConvertInput,\n\tImageCropInput,\n\tImageMetadata,\n\tImageMetadataInput,\n\tImageResizeInput,\n\tImageThumbnailInput,\n\tImageTransformOutput\n} from './contracts'\nimport { MAX_IMAGE_BYTES, imageAuthSchema, imageMetadataSchema, imageTransformOutputSchema } from './contracts'\n\nexport type ImageClientOptions = ObjectArtifactStoreOptions\n\nfunction mediaTypeFor(extension: string): string {\n\treturn mediaTypeFromPath(`image.${extension}`) ?? 'application/octet-stream'\n}\n\nfunction mapMetadata(metadata: Awaited<ReturnType<Sharp['metadata']>>): ImageMetadata {\n\treturn imageMetadataSchema.parse({\n\t\tformat: metadata.format,\n\t\tmedia_type: metadata.mediaType,\n\t\twidth: metadata.width,\n\t\theight: metadata.height,\n\t\tspace: metadata.space,\n\t\tchannels: metadata.channels,\n\t\tdensity: metadata.density,\n\t\thas_alpha: metadata.hasAlpha,\n\t\tpages: metadata.pages\n\t})\n}\n\nexport class ImageClient {\n\treadonly #artifacts: ObjectArtifactStore\n\n\tconstructor(auth: ImageAuth, options: ImageClientOptions = {}) {\n\t\tconst parsed = imageAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid image auth credentials', {\n\t\t\t\tcode: 'bad_auth',\n\t\t\t\tdetails: { issues: parsed.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\t\tthis.#artifacts = new ObjectArtifactStore(parsed.data.storage, options)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): ImageClient {\n\t\treturn new ImageClient(requireAuth(ctx, imageAuthSchema), {\n\t\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t\t...(ctx.signal && { signal: ctx.signal })\n\t\t})\n\t}\n\n\tstatic fromAuth(auth: ImageAuth, options: ImageClientOptions = {}): ImageClient {\n\t\treturn new ImageClient(auth, options)\n\t}\n\n\tasync metadata(input: ImageMetadataInput): Promise<ImageMetadata> {\n\t\ttry {\n\t\t\treturn mapMetadata(await sharp(await this.#read(input.source)).metadata())\n\t\t} catch (error) {\n\t\t\tthrow new ToolError('Failed to inspect image', { code: 'bad_input', cause: error })\n\t\t}\n\t}\n\n\tasync resize(input: ImageResizeInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.resize({\n\t\t\t\twidth: input.width,\n\t\t\t\theight: input.height,\n\t\t\t\tfit: input.fit,\n\t\t\t\twithoutEnlargement: input.without_enlargement\n\t\t\t})\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync crop(input: ImageCropInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.extract({\n\t\t\t\tleft: input.left,\n\t\t\t\ttop: input.top,\n\t\t\t\twidth: input.width,\n\t\t\t\theight: input.height\n\t\t\t})\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync thumbnail(input: ImageThumbnailInput): Promise<ImageTransformOutput> {\n\t\tconst pipeline = sharp(await this.#read(input.source))\n\t\t\t.autoOrient()\n\t\t\t.resize(input.width, input.height, { fit: 'inside', withoutEnlargement: true })\n\t\treturn this.#write(pipeline, input.output_key, input.filename)\n\t}\n\n\tasync convert(input: ImageConvertInput): Promise<ImageTransformOutput> {\n\t\tlet pipeline = sharp(await this.#read(input.source)).autoOrient()\n\t\tswitch (input.format) {\n\t\t\tcase 'jpeg':\n\t\t\t\tpipeline = pipeline.jpeg({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'png':\n\t\t\t\tpipeline = pipeline.png({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'webp':\n\t\t\t\tpipeline = pipeline.webp({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'avif':\n\t\t\t\tpipeline = pipeline.avif({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'tiff':\n\t\t\t\tpipeline = pipeline.tiff({ quality: input.quality })\n\t\t\t\tbreak\n\t\t\tcase 'gif':\n\t\t\t\tpipeline = pipeline.gif({ effort: input.quality ? Math.max(1, Math.round(input.quality / 10)) : undefined })\n\t\t}\n\t\treturn this.#write(pipeline, input.output_key, input.filename, input.format)\n\t}\n\n\tasync #read(source: ImageMetadataInput['source']): Promise<Uint8Array> {\n\t\treturn this.#artifacts.read(source, MAX_IMAGE_BYTES)\n\t}\n\n\tasync #write(\n\t\tpipeline: Sharp,\n\t\tkey: string,\n\t\tfilename?: string,\n\t\trequestedExtension?: string\n\t): Promise<ImageTransformOutput> {\n\t\ttry {\n\t\t\tconst { data, info } = await pipeline.toBuffer({ resolveWithObject: true })\n\t\t\tconst extension = requestedExtension ?? info.format\n\t\t\tconst mediaType = mediaTypeFor(extension)\n\t\t\tconst displayName = filename ?? `image.${extensionFromMediaType(mediaType) ?? extension}`\n\t\t\tconst result = await this.#artifacts.write(key, data, mediaType, displayName)\n\t\t\tconst image = mapMetadata(await sharp(data).metadata())\n\t\t\treturn imageTransformOutputSchema.parse({ result, image })\n\t\t} catch (error) {\n\t\t\tthrow new ToolError('Failed to transform image', { code: 'bad_input', cause: error })\n\t\t}\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { ImageClient } from './client'\nimport {\n\timageAuthSchema,\n\timageConvertInputSchema,\n\timageCropInputSchema,\n\timageMetadataInputSchema,\n\timageMetadataSchema,\n\timageResizeInputSchema,\n\timageThumbnailInputSchema,\n\timageTransformOutputSchema\n} from './contracts'\n\nexport const imageMetadataTool = defineTool({\n\tid: 'image-metadata',\n\tname: 'inspectImage',\n\tdescription:\n\t\t'Inspect an image artifact and return decoded format, dimensions, color space, channels, and page metadata.',\n\tinputSchema: imageMetadataInputSchema,\n\toutputSchema: imageMetadataSchema,\n\tsideEffect: 'read',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).metadata(input)\n})\n\nexport const imageResizeTool = defineTool({\n\tid: 'image-resize',\n\tname: 'resizeImage',\n\tdescription:\n\t\t'Resize an existing image ArtifactRef to a target width, height, or bounding box while preserving its format. Returns a final image ArtifactRef; use for exact resize requirements rather than general code or document tools.',\n\tinputSchema: imageResizeInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).resize(input)\n})\n\nexport const imageCropTool = defineTool({\n\tid: 'image-crop',\n\tname: 'cropImage',\n\tdescription:\n\t\t'Crop a rectangular pixel region from an existing image ArtifactRef and return a new image ArtifactRef. Use when the crop coordinates are known.',\n\tinputSchema: imageCropInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).crop(input)\n})\n\nexport const imageThumbnailTool = defineTool({\n\tid: 'image-thumbnail',\n\tname: 'createImageThumbnail',\n\tdescription:\n\t\t'Create a thumbnail ArtifactRef that fits within the requested dimensions without enlarging smaller images. Use for previews; use image-resize when exact output dimensions matter.',\n\tinputSchema: imageThumbnailInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).thumbnail(input)\n})\n\nexport const imageConvertTool = defineTool({\n\tid: 'image-convert',\n\tname: 'convertImage',\n\tdescription:\n\t\t'Re-encode an existing image ArtifactRef as JPEG, PNG, WebP, AVIF, TIFF, or GIF and return a new ArtifactRef. Use only when the required output image format differs from the source.',\n\tinputSchema: imageConvertInputSchema,\n\toutputSchema: imageTransformOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'node',\n\tartifacts: true,\n\texecute: async (input, ctx) => ImageClient.fromContext(ctx).convert(input)\n})\n\nexport const imageModule = defineModule({\n\tid: 'image',\n\ttitle: 'Image',\n\tdescription: 'Inspect, resize, crop, thumbnail, and re-encode image artifacts.',\n\truntime: 'node',\n\tauth: { type: 'custom', schema: imageAuthSchema },\n\tcategories: ['media', 'image'],\n\tclassification: 'standard',\n\ttags: ['resize', 'convert'],\n\ttools: [imageMetadataTool, imageResizeTool, imageCropTool, imageThumbnailTool, imageConvertTool]\n})\n"],"mappings":";;;;;;;;;AAQA,IAAa,sBAAb,MAAiC;CAChC;CAEA,YAAY,MAAc,UAAsC,CAAC,GAAG;EACnE,KAAKA,WAAW,IAAI,S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,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,SAAS,OAAO,OAAO,QAAQ,YAAY,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AACzE,CAAC;AAED,MAAa,gBAAgB,WAAW;CACvC,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,SAAS,OAAO,OAAO,QAAQ,YAAY,YAAY,GAAG,CAAC,CAAC,KAAK,KAAK;AACvE,CAAC;AAED,MAAa,qBAAqB,WAAW;CAC5C,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,SAAS,OAAO,OAAO,QAAQ,YAAY,YAAY,GAAG,CAAC,CAAC,UAAU,KAAK;AAC5E,CAAC;AAED,MAAa,mBAAmB,WAAW;CAC1C,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,SAAS,OAAO,OAAO,QAAQ,YAAY,YAAY,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1E,CAAC;AAED,MAAa,cAAc,aAAa;CACvC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAgB;CAChD,YAAY,CAAC,SAAS,OAAO;CAC7B,gBAAgB;CAChB,MAAM,CAAC,UAAU,SAAS;CAC1B,OAAO;EAAC;EAAmB;EAAiB;EAAe;EAAoB;CAAgB;AAChG,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as isImessageOutcomeUnknown, T as imessageAuthSchema, w as MAX_MEDIA_BYTES, x as isImessageDefiniteRejection } from "../../imessage-CofjmONG.js";
|
|
2
2
|
import { t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
3
|
-
import { n as defineModule, r as defineTool } from "../../define-
|
|
3
|
+
import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
|
|
4
4
|
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
5
5
|
import { n as bytesToBase64, t as base64ToBytes } from "../../bytes-BxpimpQx.js";
|
|
6
|
-
import { m as s3AuthSchema, p as S3Client } from "../../s3-
|
|
6
|
+
import { m as s3AuthSchema, p as S3Client } from "../../s3-Dj7Teh-A.js";
|
|
7
7
|
import { n as runBatchItems, t as batchResultSchema } from "../../batch-Co1ujeAW.js";
|
|
8
8
|
import { n as createTypingPulse, t as createLiveMessage } from "../../transport-B4vn-XiQ.js";
|
|
9
|
-
import { A as slackAuthSchema, C as isSlackOutcomeUnknown, S as isSlackDefiniteRejection, b as SlackClient, w as MAX_MEDIA_BYTES$1 } from "../../slack-
|
|
10
|
-
import { _ as isTeamsOutcomeUnknown, b as teamsAuthSchema, g as isTeamsDefiniteRejection, m as TeamsClient, v as MAX_MEDIA_BYTES$2 } from "../../teams-
|
|
11
|
-
import { _ as isTelegramOutcomeUnknown, b as telegramAuthSchema, g as isTelegramDefiniteRejection, m as TelegramClient, v as MAX_MEDIA_BYTES$3 } from "../../telegram-
|
|
9
|
+
import { A as slackAuthSchema, C as isSlackOutcomeUnknown, S as isSlackDefiniteRejection, b as SlackClient, w as MAX_MEDIA_BYTES$1 } from "../../slack-AjJDNnXJ.js";
|
|
10
|
+
import { _ as isTeamsOutcomeUnknown, b as teamsAuthSchema, g as isTeamsDefiniteRejection, m as TeamsClient, v as MAX_MEDIA_BYTES$2 } from "../../teams-CvxYLAi5.js";
|
|
11
|
+
import { _ as isTelegramOutcomeUnknown, b as telegramAuthSchema, g as isTelegramDefiniteRejection, m as TelegramClient, v as MAX_MEDIA_BYTES$3 } from "../../telegram-B_-Jljk3.js";
|
|
12
12
|
import { isError } from "es-toolkit";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
//#region src/modules/messaging/contracts.ts
|
|
@@ -434,7 +434,7 @@ var ImessageMessagingProvider = class {
|
|
|
434
434
|
async #sdk() {
|
|
435
435
|
if (this.#client) return this.#client;
|
|
436
436
|
this.#ready ??= (async () => {
|
|
437
|
-
const { ImessageClient } = await import("../../
|
|
437
|
+
const { ImessageClient } = await import("../../imessage-CofjmONG.js").then((n) => n.f);
|
|
438
438
|
const { provider: _p, storage: _s, ...vendorAuth } = this.#auth;
|
|
439
439
|
const client = new ImessageClient(vendorAuth, this.#options);
|
|
440
440
|
this.#client = client;
|