@5ss/ai-tools 2.11.1
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 +112 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/dist/ai-sdk/index.d.ts +15 -0
- package/dist/ai-sdk/index.d.ts.map +1 -0
- package/dist/ai-sdk/index.js +24 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/artifact-D064mHfK.js +44 -0
- package/dist/artifact-D064mHfK.js.map +1 -0
- package/dist/artifacts-O8g-40Pw.js +404 -0
- package/dist/artifacts-O8g-40Pw.js.map +1 -0
- package/dist/aws-json-CecFqzqX.js +23 -0
- package/dist/aws-json-CecFqzqX.js.map +1 -0
- package/dist/aws-service-msttbPrz.js +58 -0
- package/dist/aws-service-msttbPrz.js.map +1 -0
- package/dist/batch-BMM5dXqL.d.ts +22 -0
- package/dist/batch-BMM5dXqL.d.ts.map +1 -0
- package/dist/batch-Co1ujeAW.js +67 -0
- package/dist/batch-Co1ujeAW.js.map +1 -0
- package/dist/bedrock-agentcore-browser-a_qOs-NR.js +182 -0
- package/dist/bedrock-agentcore-browser-a_qOs-NR.js.map +1 -0
- package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js +357 -0
- package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js.map +1 -0
- package/dist/bytes-BxpimpQx.js +45 -0
- package/dist/bytes-BxpimpQx.js.map +1 -0
- package/dist/client-CCKGsTeI.js +743 -0
- package/dist/client-CCKGsTeI.js.map +1 -0
- package/dist/cloudflare/index.d.ts +37 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +41 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/cloudflare-browser-B6Yolpin.js +428 -0
- package/dist/cloudflare-browser-B6Yolpin.js.map +1 -0
- package/dist/cloudflare-email-Dy0KHeDf.js +197 -0
- package/dist/cloudflare-email-Dy0KHeDf.js.map +1 -0
- package/dist/cloudflare-sandbox-Dp_uNaqW.js +982 -0
- package/dist/cloudflare-sandbox-Dp_uNaqW.js.map +1 -0
- package/dist/content-type-CORxaxcv.js +49 -0
- package/dist/content-type-CORxaxcv.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +204 -0
- package/dist/core/index.js.map +1 -0
- package/dist/define-CvpJ_pNP.js +115 -0
- package/dist/define-CvpJ_pNP.js.map +1 -0
- package/dist/errors-DoSpNHvs.js +20 -0
- package/dist/errors-DoSpNHvs.js.map +1 -0
- package/dist/errors-aKhko9T1.d.ts +18 -0
- package/dist/errors-aKhko9T1.d.ts.map +1 -0
- package/dist/eventbridge-scheduler-Bh6GqZY2.js +349 -0
- package/dist/eventbridge-scheduler-Bh6GqZY2.js.map +1 -0
- package/dist/framework-context-DVIIY8ZO.js +24 -0
- package/dist/framework-context-DVIIY8ZO.js.map +1 -0
- package/dist/gotenberg-NuJjxyln.js +291 -0
- package/dist/gotenberg-NuJjxyln.js.map +1 -0
- package/dist/http/index.d.ts +47 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +3 -0
- package/dist/http-service-DDNCO1s4.js +254 -0
- package/dist/http-service-DDNCO1s4.js.map +1 -0
- package/dist/http-service-T7E5UjP8.d.ts +80 -0
- package/dist/http-service-T7E5UjP8.d.ts.map +1 -0
- package/dist/imessage-BSAFOI8Z.js +154 -0
- package/dist/imessage-BSAFOI8Z.js.map +1 -0
- package/dist/index-BU4gmYO8.d.ts +254 -0
- package/dist/index-BU4gmYO8.d.ts.map +1 -0
- package/dist/index-CCivzmxO.d.ts +188 -0
- package/dist/index-CCivzmxO.d.ts.map +1 -0
- package/dist/index-CLmTrcu5.d.ts +22 -0
- package/dist/index-CLmTrcu5.d.ts.map +1 -0
- package/dist/index-CZX5OeOF.d.ts +235 -0
- package/dist/index-CZX5OeOF.d.ts.map +1 -0
- package/dist/index-CdFmEfZO.d.ts +359 -0
- package/dist/index-CdFmEfZO.d.ts.map +1 -0
- package/dist/index-Cuh6eMWc.d.ts +285 -0
- package/dist/index-Cuh6eMWc.d.ts.map +1 -0
- package/dist/index-DuOGj7vc.d.ts +107 -0
- package/dist/index-DuOGj7vc.d.ts.map +1 -0
- package/dist/index-ccZ1XOHw.d.ts +69 -0
- package/dist/index-ccZ1XOHw.d.ts.map +1 -0
- package/dist/index-n8JTpNf1.d.ts +247 -0
- package/dist/index-n8JTpNf1.d.ts.map +1 -0
- package/dist/index-pwW1OsOx.d.ts +134 -0
- package/dist/index-pwW1OsOx.d.ts.map +1 -0
- package/dist/index-zK1ZwS4m.d.ts +347 -0
- package/dist/index-zK1ZwS4m.d.ts.map +1 -0
- package/dist/limits-hjrO8zUG.js +80 -0
- package/dist/limits-hjrO8zUG.js.map +1 -0
- package/dist/mastra/index.d.ts +14 -0
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +26 -0
- package/dist/mastra/index.js.map +1 -0
- package/dist/mastra-vector-Dhc6XZ8l.js +234 -0
- package/dist/mastra-vector-Dhc6XZ8l.js.map +1 -0
- package/dist/mcp/index.d.ts +80 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +97 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/modules/artifacts/index.d.ts +337 -0
- package/dist/modules/artifacts/index.d.ts.map +1 -0
- package/dist/modules/artifacts/index.js +348 -0
- package/dist/modules/artifacts/index.js.map +1 -0
- package/dist/modules/browser/index.d.ts +516 -0
- package/dist/modules/browser/index.d.ts.map +1 -0
- package/dist/modules/browser/index.js +475 -0
- package/dist/modules/browser/index.js.map +1 -0
- package/dist/modules/calendar/index.d.ts +93 -0
- package/dist/modules/calendar/index.d.ts.map +1 -0
- package/dist/modules/calendar/index.js +131 -0
- package/dist/modules/calendar/index.js.map +1 -0
- package/dist/modules/code-sandbox/index.d.ts +317 -0
- package/dist/modules/code-sandbox/index.d.ts.map +1 -0
- package/dist/modules/code-sandbox/index.js +537 -0
- package/dist/modules/code-sandbox/index.js.map +1 -0
- package/dist/modules/content-type/index.d.ts +22 -0
- package/dist/modules/content-type/index.d.ts.map +1 -0
- package/dist/modules/content-type/index.js +66 -0
- package/dist/modules/content-type/index.js.map +1 -0
- package/dist/modules/crypto/index.d.ts +115 -0
- package/dist/modules/crypto/index.d.ts.map +1 -0
- package/dist/modules/crypto/index.js +139 -0
- package/dist/modules/crypto/index.js.map +1 -0
- package/dist/modules/document/index.d.ts +575 -0
- package/dist/modules/document/index.d.ts.map +1 -0
- package/dist/modules/document/index.js +444 -0
- package/dist/modules/document/index.js.map +1 -0
- package/dist/modules/document-extract/index.d.ts +438 -0
- package/dist/modules/document-extract/index.d.ts.map +1 -0
- package/dist/modules/document-extract/index.js +127 -0
- package/dist/modules/document-extract/index.js.map +1 -0
- package/dist/modules/document-render/index.d.ts +336 -0
- package/dist/modules/document-render/index.d.ts.map +1 -0
- package/dist/modules/document-render/index.js +155 -0
- package/dist/modules/document-render/index.js.map +1 -0
- package/dist/modules/email/index.d.ts +311 -0
- package/dist/modules/email/index.d.ts.map +1 -0
- package/dist/modules/email/index.js +167 -0
- package/dist/modules/email/index.js.map +1 -0
- package/dist/modules/email-message/index.d.ts +95 -0
- package/dist/modules/email-message/index.d.ts.map +1 -0
- package/dist/modules/email-message/index.js +264 -0
- package/dist/modules/email-message/index.js.map +1 -0
- package/dist/modules/file-convert/index.d.ts +273 -0
- package/dist/modules/file-convert/index.d.ts.map +1 -0
- package/dist/modules/file-convert/index.js +103 -0
- package/dist/modules/file-convert/index.js.map +1 -0
- package/dist/modules/files/index.d.ts +452 -0
- package/dist/modules/files/index.d.ts.map +1 -0
- package/dist/modules/files/index.js +733 -0
- package/dist/modules/files/index.js.map +1 -0
- package/dist/modules/image/index.d.ts +342 -0
- package/dist/modules/image/index.d.ts.map +1 -0
- package/dist/modules/image/index.js +281 -0
- package/dist/modules/image/index.js.map +1 -0
- package/dist/modules/messaging/index.d.ts +608 -0
- package/dist/modules/messaging/index.d.ts.map +1 -0
- package/dist/modules/messaging/index.js +1067 -0
- package/dist/modules/messaging/index.js.map +1 -0
- package/dist/modules/pdf/index.d.ts +287 -0
- package/dist/modules/pdf/index.d.ts.map +1 -0
- package/dist/modules/pdf/index.js +259 -0
- package/dist/modules/pdf/index.js.map +1 -0
- package/dist/modules/presentation/index.d.ts +247 -0
- package/dist/modules/presentation/index.d.ts.map +1 -0
- package/dist/modules/presentation/index.js +12657 -0
- package/dist/modules/presentation/index.js.map +1 -0
- package/dist/modules/queue/index.d.ts +129 -0
- package/dist/modules/queue/index.d.ts.map +1 -0
- package/dist/modules/queue/index.js +131 -0
- package/dist/modules/queue/index.js.map +1 -0
- package/dist/modules/rag/index.d.ts +250 -0
- package/dist/modules/rag/index.d.ts.map +1 -0
- package/dist/modules/rag/index.js +366 -0
- package/dist/modules/rag/index.js.map +1 -0
- package/dist/modules/scheduler/index.d.ts +216 -0
- package/dist/modules/scheduler/index.d.ts.map +1 -0
- package/dist/modules/scheduler/index.js +153 -0
- package/dist/modules/scheduler/index.js.map +1 -0
- package/dist/modules/skills/index.d.ts +205 -0
- package/dist/modules/skills/index.d.ts.map +1 -0
- package/dist/modules/skills/index.js +203 -0
- package/dist/modules/skills/index.js.map +1 -0
- package/dist/modules/tasks/index.d.ts +287 -0
- package/dist/modules/tasks/index.d.ts.map +1 -0
- package/dist/modules/tasks/index.js +207 -0
- package/dist/modules/tasks/index.js.map +1 -0
- package/dist/modules/vector-store/index.d.ts +3 -0
- package/dist/modules/vector-store/index.js +3 -0
- package/dist/modules/web-fetch/index.d.ts +99 -0
- package/dist/modules/web-fetch/index.d.ts.map +1 -0
- package/dist/modules/web-fetch/index.js +242 -0
- package/dist/modules/web-fetch/index.js.map +1 -0
- package/dist/object-artifact-store-CMTzCm_G.d.ts +7 -0
- package/dist/object-artifact-store-CMTzCm_G.d.ts.map +1 -0
- package/dist/object-artifact-store-wZ2j9cto.js +28 -0
- package/dist/object-artifact-store-wZ2j9cto.js.map +1 -0
- package/dist/pinecone-umY4t6OF.js +190 -0
- package/dist/pinecone-umY4t6OF.js.map +1 -0
- package/dist/provider-CgDAlg6K.js +34 -0
- package/dist/provider-CgDAlg6K.js.map +1 -0
- package/dist/qdrant-DMp4NhKR.js +253 -0
- package/dist/qdrant-DMp4NhKR.js.map +1 -0
- package/dist/resend-BAC38_dA.js +155 -0
- package/dist/resend-BAC38_dA.js.map +1 -0
- package/dist/s3-CsOaPWMP.js +955 -0
- package/dist/s3-CsOaPWMP.js.map +1 -0
- package/dist/schemas-ChOAhdo9.js +192 -0
- package/dist/schemas-ChOAhdo9.js.map +1 -0
- package/dist/slack-Di5BBNpt.js +1455 -0
- package/dist/slack-Di5BBNpt.js.map +1 -0
- package/dist/sqs-DCwS1i2N.js +225 -0
- package/dist/sqs-DCwS1i2N.js.map +1 -0
- package/dist/supabase-vector-Dpp9mmJR.js +218 -0
- package/dist/supabase-vector-Dpp9mmJR.js.map +1 -0
- package/dist/tanstack/index.d.ts +15 -0
- package/dist/tanstack/index.d.ts.map +1 -0
- package/dist/tanstack/index.js +28 -0
- package/dist/tanstack/index.js.map +1 -0
- package/dist/teams-DYAHNb39.js +835 -0
- package/dist/teams-DYAHNb39.js.map +1 -0
- package/dist/telegram-DDXWzkfL.js +734 -0
- package/dist/telegram-DDXWzkfL.js.map +1 -0
- package/dist/textract-CPLiB22H.js +554 -0
- package/dist/textract-CPLiB22H.js.map +1 -0
- package/dist/transport-B4vn-XiQ.js +157 -0
- package/dist/transport-B4vn-XiQ.js.map +1 -0
- package/dist/transport-i96ACAI_.d.ts +46 -0
- package/dist/transport-i96ACAI_.d.ts.map +1 -0
- package/dist/types-Ccb0DXY9.d.ts +150 -0
- package/dist/types-Ccb0DXY9.d.ts.map +1 -0
- package/dist/unique-EwBH1JPB.js +19 -0
- package/dist/unique-EwBH1JPB.js.map +1 -0
- package/dist/vector-store-C3nEO80e.js +193 -0
- package/dist/vector-store-C3nEO80e.js.map +1 -0
- package/dist/vendors/amazon-sp-api/index.d.ts +526 -0
- package/dist/vendors/amazon-sp-api/index.d.ts.map +1 -0
- package/dist/vendors/amazon-sp-api/index.js +975 -0
- package/dist/vendors/amazon-sp-api/index.js.map +1 -0
- package/dist/vendors/bedrock-agentcore-browser/index.d.ts +2 -0
- package/dist/vendors/bedrock-agentcore-browser/index.js +2 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts +228 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts.map +1 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +2 -0
- package/dist/vendors/cloudflare-browser/index.d.ts +2 -0
- package/dist/vendors/cloudflare-browser/index.js +2 -0
- package/dist/vendors/cloudflare-email/index.d.ts +260 -0
- package/dist/vendors/cloudflare-email/index.d.ts.map +1 -0
- package/dist/vendors/cloudflare-email/index.js +3 -0
- package/dist/vendors/cloudflare-sandbox/index.d.ts +565 -0
- package/dist/vendors/cloudflare-sandbox/index.d.ts.map +1 -0
- package/dist/vendors/cloudflare-sandbox/index.js +2 -0
- package/dist/vendors/eventbridge-scheduler/index.d.ts +2 -0
- package/dist/vendors/eventbridge-scheduler/index.js +2 -0
- package/dist/vendors/gotenberg/index.d.ts +306 -0
- package/dist/vendors/gotenberg/index.d.ts.map +1 -0
- package/dist/vendors/gotenberg/index.js +2 -0
- package/dist/vendors/imessage/index.d.ts +420 -0
- package/dist/vendors/imessage/index.d.ts.map +1 -0
- package/dist/vendors/imessage/index.js +4 -0
- package/dist/vendors/katana/index.d.ts +1570 -0
- package/dist/vendors/katana/index.d.ts.map +1 -0
- package/dist/vendors/katana/index.js +1639 -0
- package/dist/vendors/katana/index.js.map +1 -0
- package/dist/vendors/mastra-vector/index.d.ts +120 -0
- package/dist/vendors/mastra-vector/index.d.ts.map +1 -0
- package/dist/vendors/mastra-vector/index.js +3 -0
- package/dist/vendors/pinecone/index.d.ts +75 -0
- package/dist/vendors/pinecone/index.d.ts.map +1 -0
- package/dist/vendors/pinecone/index.js +3 -0
- package/dist/vendors/qdrant/index.d.ts +75 -0
- package/dist/vendors/qdrant/index.d.ts.map +1 -0
- package/dist/vendors/qdrant/index.js +3 -0
- package/dist/vendors/resend/index.d.ts +3 -0
- package/dist/vendors/resend/index.js +3 -0
- package/dist/vendors/s3/index.d.ts +2 -0
- package/dist/vendors/s3/index.js +2 -0
- package/dist/vendors/slack/index.d.ts +576 -0
- package/dist/vendors/slack/index.d.ts.map +1 -0
- package/dist/vendors/slack/index.js +3 -0
- package/dist/vendors/sqs/index.d.ts +2 -0
- package/dist/vendors/sqs/index.js +2 -0
- package/dist/vendors/supabase-vector/index.d.ts +89 -0
- package/dist/vendors/supabase-vector/index.d.ts.map +1 -0
- package/dist/vendors/supabase-vector/index.js +3 -0
- package/dist/vendors/teams/index.d.ts +303 -0
- package/dist/vendors/teams/index.d.ts.map +1 -0
- package/dist/vendors/teams/index.js +3 -0
- package/dist/vendors/telegram/index.d.ts +319 -0
- package/dist/vendors/telegram/index.d.ts.map +1 -0
- package/dist/vendors/telegram/index.js +3 -0
- package/dist/vendors/textract/index.d.ts +2 -0
- package/dist/vendors/textract/index.js +2 -0
- package/dist/vendors/woocommerce/index.d.ts +1700 -0
- package/dist/vendors/woocommerce/index.d.ts.map +1 -0
- package/dist/vendors/woocommerce/index.js +1427 -0
- package/dist/vendors/woocommerce/index.js.map +1 -0
- package/dist/with-auth-CpKqTrGK.js +240 -0
- package/dist/with-auth-CpKqTrGK.js.map +1 -0
- package/logos/LUCIDE-ATTRIBUTION.txt +4 -0
- package/logos/README.md +89 -0
- package/logos/amazon.svg +6 -0
- package/logos/artifacts.svg +9 -0
- package/logos/browser.svg +9 -0
- package/logos/calendar.svg +15 -0
- package/logos/cloudflare-browser.svg +5 -0
- package/logos/cloudflare-email.svg +5 -0
- package/logos/cloudflare.svg +4 -0
- package/logos/code-sandbox.svg +8 -0
- package/logos/content-type.svg +10 -0
- package/logos/crypto.svg +7 -0
- package/logos/document-extract.svg +12 -0
- package/logos/document-render.svg +8 -0
- package/logos/document.svg +10 -0
- package/logos/email-message.svg +8 -0
- package/logos/email.svg +7 -0
- package/logos/file-convert.svg +9 -0
- package/logos/files.svg +6 -0
- package/logos/gotenberg.svg +340 -0
- package/logos/image.svg +8 -0
- package/logos/imessage.svg +7 -0
- package/logos/katana.svg +13 -0
- package/logos/mastra.svg +7 -0
- package/logos/messaging.svg +7 -0
- package/logos/pack-logos.json +48 -0
- package/logos/pdf.svg +10 -0
- package/logos/pinecone.svg +25 -0
- package/logos/presentation.svg +8 -0
- package/logos/qdrant.svg +4 -0
- package/logos/queue.svg +11 -0
- package/logos/rag.svg +18 -0
- package/logos/resend.svg +5 -0
- package/logos/scheduler.svg +7 -0
- package/logos/skills.svg +10 -0
- package/logos/slack.svg +14 -0
- package/logos/supabase.svg +4 -0
- package/logos/tasks.svg +10 -0
- package/logos/teams.svg +6 -0
- package/logos/telegram.svg +10 -0
- package/logos/textract.svg +5 -0
- package/logos/vector-store.svg +8 -0
- package/logos/web-fetch.svg +8 -0
- package/logos/woocommerce.svg +4 -0
- package/package.json +373 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { t as ToolError } from "../../errors-DoSpNHvs.js";
|
|
2
|
+
import { n as defineModule, r as defineTool } from "../../define-CvpJ_pNP.js";
|
|
3
|
+
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
4
|
+
import { t as artifactRefSchema } from "../../artifact-D064mHfK.js";
|
|
5
|
+
import { m as s3AuthSchema } from "../../s3-CsOaPWMP.js";
|
|
6
|
+
import { n as extensionFromMediaType, r as mediaTypeFromPath } from "../../content-type-CORxaxcv.js";
|
|
7
|
+
import { t as ObjectArtifactStore } from "../../object-artifact-store-wZ2j9cto.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import sharp from "sharp";
|
|
10
|
+
//#region src/modules/image/contracts.ts
|
|
11
|
+
const MAX_IMAGE_BYTES = 50 * 1024 * 1024;
|
|
12
|
+
const MAX_IMAGE_DIMENSION = 16384;
|
|
13
|
+
const imageAuthSchema = z.object({ storage: s3AuthSchema.describe("Object storage for source and output image artifacts") });
|
|
14
|
+
const source = artifactRefSchema.describe("Source image artifact");
|
|
15
|
+
const outputKey = z.string().min(1).max(1024).describe("Destination object key");
|
|
16
|
+
const filename = z.string().min(1).max(512).optional().describe("Display filename for the output image");
|
|
17
|
+
const dimension = z.int().min(1).max(MAX_IMAGE_DIMENSION);
|
|
18
|
+
const quality = z.int().min(1).max(100).optional().describe("Encoder quality from 1 to 100");
|
|
19
|
+
const imageMetadataInputSchema = z.object({ source });
|
|
20
|
+
const imageMetadataSchema = z.object({
|
|
21
|
+
format: z.string(),
|
|
22
|
+
media_type: z.string().optional(),
|
|
23
|
+
width: z.int().positive(),
|
|
24
|
+
height: z.int().positive(),
|
|
25
|
+
space: z.string(),
|
|
26
|
+
channels: z.int().positive(),
|
|
27
|
+
density: z.number().positive().optional(),
|
|
28
|
+
has_alpha: z.boolean(),
|
|
29
|
+
pages: z.int().positive().optional()
|
|
30
|
+
});
|
|
31
|
+
const imageTransformOutputSchema = z.object({
|
|
32
|
+
result: artifactRefSchema.describe("Written image artifact"),
|
|
33
|
+
image: imageMetadataSchema
|
|
34
|
+
});
|
|
35
|
+
const imageResizeInputSchema = z.object({
|
|
36
|
+
source,
|
|
37
|
+
width: dimension.optional().describe("Target width in pixels"),
|
|
38
|
+
height: dimension.optional().describe("Target height in pixels"),
|
|
39
|
+
fit: z.enum([
|
|
40
|
+
"cover",
|
|
41
|
+
"contain",
|
|
42
|
+
"fill",
|
|
43
|
+
"inside",
|
|
44
|
+
"outside"
|
|
45
|
+
]).optional().describe("How the image fits the target box"),
|
|
46
|
+
without_enlargement: z.boolean().optional().describe("Prevent enlarging smaller images"),
|
|
47
|
+
output_key: outputKey,
|
|
48
|
+
filename
|
|
49
|
+
}).refine((input) => input.width !== void 0 || input.height !== void 0, {
|
|
50
|
+
message: "width or height is required",
|
|
51
|
+
path: ["width"]
|
|
52
|
+
});
|
|
53
|
+
const imageCropInputSchema = z.object({
|
|
54
|
+
source,
|
|
55
|
+
left: z.int().min(0).describe("Left edge in pixels"),
|
|
56
|
+
top: z.int().min(0).describe("Top edge in pixels"),
|
|
57
|
+
width: dimension.describe("Crop width in pixels"),
|
|
58
|
+
height: dimension.describe("Crop height in pixels"),
|
|
59
|
+
output_key: outputKey,
|
|
60
|
+
filename
|
|
61
|
+
});
|
|
62
|
+
const imageThumbnailInputSchema = z.object({
|
|
63
|
+
source,
|
|
64
|
+
width: dimension.describe("Maximum thumbnail width in pixels"),
|
|
65
|
+
height: dimension.describe("Maximum thumbnail height in pixels"),
|
|
66
|
+
output_key: outputKey,
|
|
67
|
+
filename
|
|
68
|
+
});
|
|
69
|
+
const imageFormatSchema = z.enum([
|
|
70
|
+
"jpeg",
|
|
71
|
+
"png",
|
|
72
|
+
"webp",
|
|
73
|
+
"avif",
|
|
74
|
+
"tiff",
|
|
75
|
+
"gif"
|
|
76
|
+
]);
|
|
77
|
+
const imageConvertInputSchema = z.object({
|
|
78
|
+
source,
|
|
79
|
+
format: imageFormatSchema.describe("Destination image format"),
|
|
80
|
+
quality,
|
|
81
|
+
output_key: outputKey,
|
|
82
|
+
filename
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/modules/image/client.ts
|
|
86
|
+
function mediaTypeFor(extension) {
|
|
87
|
+
return mediaTypeFromPath(`image.${extension}`) ?? "application/octet-stream";
|
|
88
|
+
}
|
|
89
|
+
function mapMetadata(metadata) {
|
|
90
|
+
return imageMetadataSchema.parse({
|
|
91
|
+
format: metadata.format,
|
|
92
|
+
media_type: metadata.mediaType,
|
|
93
|
+
width: metadata.width,
|
|
94
|
+
height: metadata.height,
|
|
95
|
+
space: metadata.space,
|
|
96
|
+
channels: metadata.channels,
|
|
97
|
+
density: metadata.density,
|
|
98
|
+
has_alpha: metadata.hasAlpha,
|
|
99
|
+
pages: metadata.pages
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
var ImageClient = class ImageClient {
|
|
103
|
+
#artifacts;
|
|
104
|
+
constructor(auth, options = {}) {
|
|
105
|
+
const parsed = imageAuthSchema.safeParse(auth);
|
|
106
|
+
if (!parsed.success) throw new ToolError("Invalid image auth credentials", {
|
|
107
|
+
code: "bad_auth",
|
|
108
|
+
details: { issues: parsed.error.issues.map((issue) => issue.message) }
|
|
109
|
+
});
|
|
110
|
+
this.#artifacts = new ObjectArtifactStore(parsed.data.storage, options);
|
|
111
|
+
}
|
|
112
|
+
static fromContext(ctx) {
|
|
113
|
+
return new ImageClient(requireAuth(ctx, imageAuthSchema), {
|
|
114
|
+
...ctx.fetch && { fetch: ctx.fetch },
|
|
115
|
+
...ctx.signal && { signal: ctx.signal }
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
static fromAuth(auth, options = {}) {
|
|
119
|
+
return new ImageClient(auth, options);
|
|
120
|
+
}
|
|
121
|
+
async metadata(input) {
|
|
122
|
+
try {
|
|
123
|
+
return mapMetadata(await sharp(await this.#read(input.source)).metadata());
|
|
124
|
+
} catch (error) {
|
|
125
|
+
throw new ToolError("Failed to inspect image", {
|
|
126
|
+
code: "bad_input",
|
|
127
|
+
cause: error
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async resize(input) {
|
|
132
|
+
const pipeline = sharp(await this.#read(input.source)).autoOrient().resize({
|
|
133
|
+
width: input.width,
|
|
134
|
+
height: input.height,
|
|
135
|
+
fit: input.fit,
|
|
136
|
+
withoutEnlargement: input.without_enlargement
|
|
137
|
+
});
|
|
138
|
+
return this.#write(pipeline, input.output_key, input.filename);
|
|
139
|
+
}
|
|
140
|
+
async crop(input) {
|
|
141
|
+
const pipeline = sharp(await this.#read(input.source)).autoOrient().extract({
|
|
142
|
+
left: input.left,
|
|
143
|
+
top: input.top,
|
|
144
|
+
width: input.width,
|
|
145
|
+
height: input.height
|
|
146
|
+
});
|
|
147
|
+
return this.#write(pipeline, input.output_key, input.filename);
|
|
148
|
+
}
|
|
149
|
+
async thumbnail(input) {
|
|
150
|
+
const pipeline = sharp(await this.#read(input.source)).autoOrient().resize(input.width, input.height, {
|
|
151
|
+
fit: "inside",
|
|
152
|
+
withoutEnlargement: true
|
|
153
|
+
});
|
|
154
|
+
return this.#write(pipeline, input.output_key, input.filename);
|
|
155
|
+
}
|
|
156
|
+
async convert(input) {
|
|
157
|
+
let pipeline = sharp(await this.#read(input.source)).autoOrient();
|
|
158
|
+
switch (input.format) {
|
|
159
|
+
case "jpeg":
|
|
160
|
+
pipeline = pipeline.jpeg({ quality: input.quality });
|
|
161
|
+
break;
|
|
162
|
+
case "png":
|
|
163
|
+
pipeline = pipeline.png({ quality: input.quality });
|
|
164
|
+
break;
|
|
165
|
+
case "webp":
|
|
166
|
+
pipeline = pipeline.webp({ quality: input.quality });
|
|
167
|
+
break;
|
|
168
|
+
case "avif":
|
|
169
|
+
pipeline = pipeline.avif({ quality: input.quality });
|
|
170
|
+
break;
|
|
171
|
+
case "tiff":
|
|
172
|
+
pipeline = pipeline.tiff({ quality: input.quality });
|
|
173
|
+
break;
|
|
174
|
+
case "gif": pipeline = pipeline.gif({ effort: input.quality ? Math.max(1, Math.round(input.quality / 10)) : void 0 });
|
|
175
|
+
}
|
|
176
|
+
return this.#write(pipeline, input.output_key, input.filename, input.format);
|
|
177
|
+
}
|
|
178
|
+
async #read(source) {
|
|
179
|
+
return this.#artifacts.read(source, MAX_IMAGE_BYTES);
|
|
180
|
+
}
|
|
181
|
+
async #write(pipeline, key, filename, requestedExtension) {
|
|
182
|
+
try {
|
|
183
|
+
const { data, info } = await pipeline.toBuffer({ resolveWithObject: true });
|
|
184
|
+
const extension = requestedExtension ?? info.format;
|
|
185
|
+
const mediaType = mediaTypeFor(extension);
|
|
186
|
+
const displayName = filename ?? `image.${extensionFromMediaType(mediaType) ?? extension}`;
|
|
187
|
+
const result = await this.#artifacts.write(key, data, mediaType, displayName);
|
|
188
|
+
const image = mapMetadata(await sharp(data).metadata());
|
|
189
|
+
return imageTransformOutputSchema.parse({
|
|
190
|
+
result,
|
|
191
|
+
image
|
|
192
|
+
});
|
|
193
|
+
} catch (error) {
|
|
194
|
+
throw new ToolError("Failed to transform image", {
|
|
195
|
+
code: "bad_input",
|
|
196
|
+
cause: error
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/modules/image/module.ts
|
|
203
|
+
const imageMetadataTool = defineTool({
|
|
204
|
+
id: "image-metadata",
|
|
205
|
+
name: "inspectImage",
|
|
206
|
+
description: "Inspect an image artifact and return decoded format, dimensions, color space, channels, and page metadata.",
|
|
207
|
+
inputSchema: imageMetadataInputSchema,
|
|
208
|
+
outputSchema: imageMetadataSchema,
|
|
209
|
+
sideEffect: "read",
|
|
210
|
+
runtime: "node",
|
|
211
|
+
artifacts: true,
|
|
212
|
+
execute: async (input, ctx) => ImageClient.fromContext(ctx).metadata(input)
|
|
213
|
+
});
|
|
214
|
+
const imageResizeTool = defineTool({
|
|
215
|
+
id: "image-resize",
|
|
216
|
+
name: "resizeImage",
|
|
217
|
+
description: "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.",
|
|
218
|
+
inputSchema: imageResizeInputSchema,
|
|
219
|
+
outputSchema: imageTransformOutputSchema,
|
|
220
|
+
sideEffect: "write",
|
|
221
|
+
runtime: "node",
|
|
222
|
+
artifacts: true,
|
|
223
|
+
execute: async (input, ctx) => ImageClient.fromContext(ctx).resize(input)
|
|
224
|
+
});
|
|
225
|
+
const imageCropTool = defineTool({
|
|
226
|
+
id: "image-crop",
|
|
227
|
+
name: "cropImage",
|
|
228
|
+
description: "Crop a rectangular pixel region from an existing image ArtifactRef and return a new image ArtifactRef. Use when the crop coordinates are known.",
|
|
229
|
+
inputSchema: imageCropInputSchema,
|
|
230
|
+
outputSchema: imageTransformOutputSchema,
|
|
231
|
+
sideEffect: "write",
|
|
232
|
+
runtime: "node",
|
|
233
|
+
artifacts: true,
|
|
234
|
+
execute: async (input, ctx) => ImageClient.fromContext(ctx).crop(input)
|
|
235
|
+
});
|
|
236
|
+
const imageThumbnailTool = defineTool({
|
|
237
|
+
id: "image-thumbnail",
|
|
238
|
+
name: "createImageThumbnail",
|
|
239
|
+
description: "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.",
|
|
240
|
+
inputSchema: imageThumbnailInputSchema,
|
|
241
|
+
outputSchema: imageTransformOutputSchema,
|
|
242
|
+
sideEffect: "write",
|
|
243
|
+
runtime: "node",
|
|
244
|
+
artifacts: true,
|
|
245
|
+
execute: async (input, ctx) => ImageClient.fromContext(ctx).thumbnail(input)
|
|
246
|
+
});
|
|
247
|
+
const imageConvertTool = defineTool({
|
|
248
|
+
id: "image-convert",
|
|
249
|
+
name: "convertImage",
|
|
250
|
+
description: "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.",
|
|
251
|
+
inputSchema: imageConvertInputSchema,
|
|
252
|
+
outputSchema: imageTransformOutputSchema,
|
|
253
|
+
sideEffect: "write",
|
|
254
|
+
runtime: "node",
|
|
255
|
+
artifacts: true,
|
|
256
|
+
execute: async (input, ctx) => ImageClient.fromContext(ctx).convert(input)
|
|
257
|
+
});
|
|
258
|
+
const imageModule = defineModule({
|
|
259
|
+
id: "image",
|
|
260
|
+
title: "Image",
|
|
261
|
+
description: "Inspect, resize, crop, thumbnail, and re-encode image artifacts.",
|
|
262
|
+
runtime: "node",
|
|
263
|
+
auth: {
|
|
264
|
+
type: "custom",
|
|
265
|
+
schema: imageAuthSchema
|
|
266
|
+
},
|
|
267
|
+
categories: ["media", "image"],
|
|
268
|
+
classification: "standard",
|
|
269
|
+
tags: ["resize", "convert"],
|
|
270
|
+
tools: [
|
|
271
|
+
imageMetadataTool,
|
|
272
|
+
imageResizeTool,
|
|
273
|
+
imageCropTool,
|
|
274
|
+
imageThumbnailTool,
|
|
275
|
+
imageConvertTool
|
|
276
|
+
]
|
|
277
|
+
});
|
|
278
|
+
//#endregion
|
|
279
|
+
export { ImageClient, MAX_IMAGE_BYTES, MAX_IMAGE_DIMENSION, imageAuthSchema, imageConvertInputSchema, imageConvertTool, imageCropInputSchema, imageCropTool, imageFormatSchema, imageMetadataInputSchema, imageMetadataSchema, imageMetadataTool, imageModule, imageResizeInputSchema, imageResizeTool, imageThumbnailInputSchema, imageThumbnailTool, imageTransformOutputSchema };
|
|
280
|
+
|
|
281
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,uBAAuB;AACjE,MAAM,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAK,CAAC,CAAC,SAAS,wBAAwB;AAChF,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,uCAAuC;AACvG,MAAM,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,mBAAmB;AACxD,MAAM,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,+BAA+B;AAE3F,MAAa,2BAA2B,EAAE,OAAO,EAAE,OAAO,CAAC;AAE3D,MAAa,sBAAsB,EAAE,OAAO;CAC3C,QAAQ,EAAE,OAAO;CACjB,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;CAChC,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS;CACxB,QAAQ,EAAE,IAAI,CAAC,CAAC,SAAS;CACz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