@5ss/ai-tools 3.7.1 → 3.7.2
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/dist/{bedrock-agentcore-browser-DwDSP_YL.js → bedrock-agentcore-browser-yrEY9cUi.js} +2 -2
- package/dist/{bedrock-agentcore-browser-DwDSP_YL.js.map → bedrock-agentcore-browser-yrEY9cUi.js.map} +1 -1
- package/dist/{bedrock-agentcore-code-interpreter-F0dnrAm4.js → bedrock-agentcore-code-interpreter-BnJnDxCp.js} +2 -2
- package/dist/{bedrock-agentcore-code-interpreter-F0dnrAm4.js.map → bedrock-agentcore-code-interpreter-BnJnDxCp.js.map} +1 -1
- package/dist/{cloudflare-browser-D-HT43hu.js → cloudflare-browser-D9pG4RTj.js} +3 -3
- package/dist/{cloudflare-browser-D-HT43hu.js.map → cloudflare-browser-D9pG4RTj.js.map} +1 -1
- package/dist/{cloudflare-email-BLI3z96V.js → cloudflare-email-bsq902dg.js} +2 -2
- package/dist/{cloudflare-email-BLI3z96V.js.map → cloudflare-email-bsq902dg.js.map} +1 -1
- package/dist/{cloudflare-sandbox-DII392Z9.js → cloudflare-sandbox-DHE4fmiq.js} +3 -3
- package/dist/{cloudflare-sandbox-DII392Z9.js.map → cloudflare-sandbox-DHE4fmiq.js.map} +1 -1
- package/dist/core/index.js +1 -1
- package/dist/{define-ieoksEQ0.js → define-DdFALdNf.js} +2 -1
- package/dist/define-DdFALdNf.js.map +1 -0
- package/dist/{eventbridge-scheduler-CDmO2-Te.js → eventbridge-scheduler-ICepMPWG.js} +2 -2
- package/dist/{eventbridge-scheduler-CDmO2-Te.js.map → eventbridge-scheduler-ICepMPWG.js.map} +1 -1
- package/dist/{imessage-Dsms04rC.js → imessage-B-0DZfMa.js} +2 -2
- package/dist/{imessage-Dsms04rC.js.map → imessage-B-0DZfMa.js.map} +1 -1
- package/dist/index-CZX5OeOF.d.ts.map +1 -1
- package/dist/{mastra-vector-B8HjvdMT.js → mastra-vector-qKG3L-Rw.js} +2 -2
- package/dist/{mastra-vector-B8HjvdMT.js.map → mastra-vector-qKG3L-Rw.js.map} +1 -1
- package/dist/modules/artifacts/index.js +2 -2
- 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 +1 -1
- package/dist/modules/crypto/index.js +1 -1
- package/dist/modules/document-extract/index.js +2 -2
- package/dist/modules/document-render/index.js +2 -2
- 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.js +2 -2
- package/dist/modules/messaging/index.js +6 -6
- 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-BvdXAZMi.js → pinecone-tmtu3ZS5.js} +2 -2
- package/dist/{pinecone-BvdXAZMi.js.map → pinecone-tmtu3ZS5.js.map} +1 -1
- package/dist/{qdrant-D2E2Lxrw.js → qdrant-zbCHUsnv.js} +2 -2
- package/dist/{qdrant-D2E2Lxrw.js.map → qdrant-zbCHUsnv.js.map} +1 -1
- package/dist/{resend-A2SnRdQ8.js → resend-Cfgm4HuV.js} +2 -2
- package/dist/{resend-A2SnRdQ8.js.map → resend-Cfgm4HuV.js.map} +1 -1
- package/dist/{s3-CoZQRTfe.js → s3-TKCIZZ2q.js} +2 -2
- package/dist/{s3-CoZQRTfe.js.map → s3-TKCIZZ2q.js.map} +1 -1
- package/dist/{slack-C9UJ0b61.js → slack-D6XzBS3b.js} +2 -2
- package/dist/{slack-C9UJ0b61.js.map → slack-D6XzBS3b.js.map} +1 -1
- package/dist/{sqs-DxFnfODk.js → sqs-B50DWyTf.js} +2 -2
- package/dist/{sqs-DxFnfODk.js.map → sqs-B50DWyTf.js.map} +1 -1
- package/dist/{supabase-vector-DT3qfnt2.js → supabase-vector-CDKOyvj1.js} +2 -2
- package/dist/{supabase-vector-DT3qfnt2.js.map → supabase-vector-CDKOyvj1.js.map} +1 -1
- package/dist/{teams-NODh3i6U.js → teams-bGfle6pU.js} +2 -2
- package/dist/{teams-NODh3i6U.js.map → teams-bGfle6pU.js.map} +1 -1
- package/dist/{telegram-CWMHBeKo.js → telegram-B-TZi9fM.js} +2 -2
- package/dist/{telegram-CWMHBeKo.js.map → telegram-B-TZi9fM.js.map} +1 -1
- package/dist/{textract-2jkPuRiE.js → textract-CthgcP6w.js} +3 -3
- package/dist/{textract-2jkPuRiE.js.map → textract-CthgcP6w.js.map} +1 -1
- package/dist/{vector-store-CDQaQXFV.js → vector-store-DrwuMOne.js} +6 -6
- package/dist/{vector-store-CDQaQXFV.js.map → vector-store-DrwuMOne.js.map} +1 -1
- package/dist/vendors/amazon-sp-api/index.js +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 -1
- 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/shipstation/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 +1 -0
- package/logos/pack-logos.json +1 -0
- package/logos/shipstation.svg +12 -0
- package/package.json +1 -1
- package/dist/define-ieoksEQ0.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resend-A2SnRdQ8.js","names":["#http"],"sources":["../src/vendors/resend/contracts.ts","../src/vendors/resend/domain.ts","../src/vendors/resend/client.ts","../src/vendors/resend/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\nimport type { NamedAddress } from '../_email'\nimport { attachmentSchema, MAX_BATCH_EMAILS, MAX_EMAIL_BYTES, namedAddressSchema } from '../_email'\n\nexport { MAX_BATCH_EMAILS, MAX_EMAIL_BYTES, namedAddressSchema, attachmentSchema }\nexport type { NamedAddress }\n\nexport const resendAuthSchema = z.object({\n\tapi_key: z.string().min(1).describe('Resend API key')\n})\n\nexport type ResendAuth = z.infer<typeof resendAuthSchema>\n\nexport const resendSendInputSchema = z\n\t.object({\n\t\tto: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).min(1).max(50)])\n\t\t\t.describe('Primary recipient address or list (max 50 combined to/cc/bcc)'),\n\t\tfrom: namedAddressSchema.describe('Verified sender address on the sending domain'),\n\t\tsubject: z.string().min(1).max(998).describe('Email subject line'),\n\t\thtml: z.string().optional().describe('HTML body. Provide html and/or text'),\n\t\ttext: z.string().optional().describe('Plain text body. Provide html and/or text'),\n\t\tcc: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).max(50)])\n\t\t\t.optional()\n\t\t\t.describe('CC recipients'),\n\t\tbcc: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).max(50)])\n\t\t\t.optional()\n\t\t\t.describe('BCC recipients'),\n\t\treply_to: namedAddressSchema.optional().describe('Reply-To address'),\n\t\theaders: z.record(z.string(), z.string()).optional().describe('Custom headers as a string map'),\n\t\tattachments: z\n\t\t\t.array(attachmentSchema)\n\t\t\t.max(32)\n\t\t\t.optional()\n\t\t\t.describe('Up to 32 base64 attachments. Total message must stay under 5 MiB')\n\t})\n\t.refine((v) => Boolean(v.html?.trim() || v.text?.trim()), {\n\t\tmessage: 'Provide html and/or text body'\n\t})\n\nexport const resendSendOutputSchema = z.object({\n\tsuccess: z.boolean().describe('Whether Resend accepted the request'),\n\tid: z.string().optional().describe('Resend message id when available')\n})\n\nexport const resendSendBatchInputSchema = z.object({\n\tmessages: z.array(resendSendInputSchema).min(1).max(MAX_BATCH_EMAILS).describe('Messages to send (max 20)')\n})\n\nexport const resendSendBatchOutputSchema = batchResultSchema(resendSendOutputSchema)\n\nexport type ResendSendInput = z.infer<typeof resendSendInputSchema>\nexport type ResendSendOutput = z.infer<typeof resendSendOutputSchema>\nexport type ResendSendBatchInput = z.infer<typeof resendSendBatchInputSchema>\nexport type ResendSendBatchOutput = z.infer<typeof resendSendBatchOutputSchema>\n","/**\n * Resend payload shaping + response parse.\n * Vertical helpers: `vendors/_email`.\n */\n\nimport { isPlainObject, isString, pick } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { addressList, addressToString, assertEmailSize, assertRecipientLimit } from '../_email'\nimport type { ResendSendInput, ResendSendOutput } from './contracts'\n\nexport function buildSendPayload(input: ResendSendInput): Record<string, unknown> {\n\treturn {\n\t\t...pick(input, ['subject', 'html', 'text', 'headers']),\n\t\tfrom: addressToString(input.from),\n\t\tto: addressList(input.to),\n\t\tcc: addressList(input.cc),\n\t\tbcc: addressList(input.bcc),\n\t\t...(input.reply_to && { reply_to: addressToString(input.reply_to) }),\n\t\t...(input.attachments && {\n\t\t\tattachments: input.attachments.map((att) => ({\n\t\t\t\tfilename: att.filename,\n\t\t\t\tcontent: att.content,\n\t\t\t\tcontent_type: att.type,\n\t\t\t\t...(att.disposition && { content_disposition: att.disposition }),\n\t\t\t\t// Resend REST uses content_id for CID inline images.\n\t\t\t\t...(att.content_id && { content_id: att.content_id })\n\t\t\t}))\n\t\t})\n\t}\n}\n\nexport function preflightSend(input: ResendSendInput): Record<string, unknown> {\n\tassertRecipientLimit(input)\n\tconst payload = buildSendPayload(input)\n\tassertEmailSize(\n\t\tpayload,\n\t\tinput.attachments?.map((a) => a.content)\n\t)\n\treturn payload\n}\n\n/** Map Resend `{ id }` success body to tool output. */\nexport function parseSendResult(data: unknown): ResendSendOutput {\n\tif (!isPlainObject(data)) {\n\t\tthrow new ToolError('Resend returned an unexpected payload', { code: 'upstream' })\n\t}\n\tconst id = data['id']\n\treturn {\n\t\tsuccess: true,\n\t\t...(isString(id) && id.length > 0 && { id })\n\t}\n}\n","/**\n * Resend vendor client.\n * Host: `new ResendClient(auth)`. Agent tools: `fromContext(ctx)`.\n */\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { runBatchItems } from '../../shared/batch'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport type {\n\tResendAuth,\n\tResendSendBatchInput,\n\tResendSendBatchOutput,\n\tResendSendInput,\n\tResendSendOutput\n} from './contracts'\nimport { resendAuthSchema } from './contracts'\nimport { parseSendResult, preflightSend } from './domain'\n\nexport type ResendClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class ResendClient {\n\treadonly #http: HttpService\n\n\tconstructor(auth: ResendAuth, options: ResendClientOptions = {}) {\n\t\tconst parsed = resendAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Resend 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.#http = new HttpService({\n\t\t\t...options,\n\t\t\tbaseURL: 'https://api.resend.com',\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${parsed.data.api_key}`,\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tlabel: 'Resend'\n\t\t})\n\t}\n\n\tstatic fromContext(ctx: ToolContext): ResendClient {\n\t\tconst auth = requireAuth(ctx, resendAuthSchema)\n\t\treturn new ResendClient(auth, {\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\t/** POST /emails */\n\tasync send(input: ResendSendInput): Promise<ResendSendOutput> {\n\t\tconst payload = preflightSend(input)\n\t\tconst { data } = await this.#http.post('/emails', payload, { label: 'Resend send' })\n\t\treturn parseSendResult(data)\n\t}\n\n\t/** Sequential batch of independent sends (partial failure OK). */\n\tasync sendBatch(input: ResendSendBatchInput): Promise<ResendSendBatchOutput> {\n\t\treturn runBatchItems(input.messages, (message) => this.send(message))\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { ResendClient } from './client'\nimport {\n\tresendAuthSchema,\n\tresendSendBatchInputSchema,\n\tresendSendBatchOutputSchema,\n\tresendSendInputSchema,\n\tresendSendOutputSchema\n} from './contracts'\n\n/** Single-email send tool. Host binds auth via withAuth. */\nexport const resendSendTool = defineTool({\n\tid: 'resend-send',\n\tname: 'resendSend',\n\tdescription:\n\t\t'Send one email via Resend. Subject plus html and/or text. Optional cc, bcc, reply_to, headers, base64 attachments. Total under 5 MiB.',\n\tinputSchema: resendSendInputSchema,\n\toutputSchema: resendSendOutputSchema,\n\tsideEffect: 'send',\n\truntime: 'both',\n\texecute: async (input, ctx) => ResendClient.fromContext(ctx).send(input)\n})\n\n/** Batch send (max 20). Per-message success/error; does not abort the batch. */\nexport const resendSendBatchTool = defineTool({\n\tid: 'resend-send-batch',\n\tname: 'resendSendBatch',\n\tdescription: 'Send up to 20 emails via Resend. Per-message success or error without aborting the batch.',\n\tinputSchema: resendSendBatchInputSchema,\n\toutputSchema: resendSendBatchOutputSchema,\n\tsideEffect: 'send',\n\truntime: 'both',\n\texecute: async (input, ctx) => ResendClient.fromContext(ctx).sendBatch(input)\n})\n\nexport const resendModule = defineModule({\n\tid: 'resend',\n\ttitle: 'Resend',\n\tdescription: 'Resend vendor pack: send one email or a batch (max 20). Not a multi-provider email seam.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: resendAuthSchema },\n\tcategories: ['email'],\n\tclassification: 'pii',\n\ttags: ['send'],\n\ttools: [resendSendTool, resendSendBatchTool]\n})\n"],"mappings":";;;;;;;;;AASA,MAAa,mBAAmB,EAAE,OAAO,EACxC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,gBAAgB,EACrD,CAAC;AAID,MAAa,wBAAwB,EACnC,OAAO;CACP,IAAI,EACF,MAAM,CAAC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACvE,SAAS,+DAA+D;CAC1E,MAAM,mBAAmB,SAAS,+CAA+C;CACjF,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,oBAAoB;CACjE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qCAAqC;CAC1E,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,2CAA2C;CAChF,IAAI,EACF,MAAM,CAAC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAChE,SAAS,CAAC,CACV,SAAS,eAAe;CAC1B,KAAK,EACH,MAAM,CAAC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAChE,SAAS,CAAC,CACV,SAAS,gBAAgB;CAC3B,UAAU,mBAAmB,SAAS,CAAC,CAAC,SAAS,kBAAkB;CACnE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,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xC,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,KAAK,KAAK;AACxE,CAAC;;AAGD,MAAa,sBAAsB,WAAW;CAC7C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,UAAU,KAAK;AAC7E,CAAC;AAED,MAAa,eAAe,aAAa;CACxC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAiB;CACjD,YAAY,CAAC,OAAO;CACpB,gBAAgB;CAChB,MAAM,CAAC,MAAM;CACb,OAAO,CAAC,gBAAgB,mBAAmB;AAC5C,CAAC"}
|
|
1
|
+
{"version":3,"file":"resend-Cfgm4HuV.js","names":["#http"],"sources":["../src/vendors/resend/contracts.ts","../src/vendors/resend/domain.ts","../src/vendors/resend/client.ts","../src/vendors/resend/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\nimport type { NamedAddress } from '../_email'\nimport { attachmentSchema, MAX_BATCH_EMAILS, MAX_EMAIL_BYTES, namedAddressSchema } from '../_email'\n\nexport { MAX_BATCH_EMAILS, MAX_EMAIL_BYTES, namedAddressSchema, attachmentSchema }\nexport type { NamedAddress }\n\nexport const resendAuthSchema = z.object({\n\tapi_key: z.string().min(1).describe('Resend API key')\n})\n\nexport type ResendAuth = z.infer<typeof resendAuthSchema>\n\nexport const resendSendInputSchema = z\n\t.object({\n\t\tto: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).min(1).max(50)])\n\t\t\t.describe('Primary recipient address or list (max 50 combined to/cc/bcc)'),\n\t\tfrom: namedAddressSchema.describe('Verified sender address on the sending domain'),\n\t\tsubject: z.string().min(1).max(998).describe('Email subject line'),\n\t\thtml: z.string().optional().describe('HTML body. Provide html and/or text'),\n\t\ttext: z.string().optional().describe('Plain text body. Provide html and/or text'),\n\t\tcc: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).max(50)])\n\t\t\t.optional()\n\t\t\t.describe('CC recipients'),\n\t\tbcc: z\n\t\t\t.union([namedAddressSchema, z.array(namedAddressSchema).max(50)])\n\t\t\t.optional()\n\t\t\t.describe('BCC recipients'),\n\t\treply_to: namedAddressSchema.optional().describe('Reply-To address'),\n\t\theaders: z.record(z.string(), z.string()).optional().describe('Custom headers as a string map'),\n\t\tattachments: z\n\t\t\t.array(attachmentSchema)\n\t\t\t.max(32)\n\t\t\t.optional()\n\t\t\t.describe('Up to 32 base64 attachments. Total message must stay under 5 MiB')\n\t})\n\t.refine((v) => Boolean(v.html?.trim() || v.text?.trim()), {\n\t\tmessage: 'Provide html and/or text body'\n\t})\n\nexport const resendSendOutputSchema = z.object({\n\tsuccess: z.boolean().describe('Whether Resend accepted the request'),\n\tid: z.string().optional().describe('Resend message id when available')\n})\n\nexport const resendSendBatchInputSchema = z.object({\n\tmessages: z.array(resendSendInputSchema).min(1).max(MAX_BATCH_EMAILS).describe('Messages to send (max 20)')\n})\n\nexport const resendSendBatchOutputSchema = batchResultSchema(resendSendOutputSchema)\n\nexport type ResendSendInput = z.infer<typeof resendSendInputSchema>\nexport type ResendSendOutput = z.infer<typeof resendSendOutputSchema>\nexport type ResendSendBatchInput = z.infer<typeof resendSendBatchInputSchema>\nexport type ResendSendBatchOutput = z.infer<typeof resendSendBatchOutputSchema>\n","/**\n * Resend payload shaping + response parse.\n * Vertical helpers: `vendors/_email`.\n */\n\nimport { isPlainObject, isString, pick } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { addressList, addressToString, assertEmailSize, assertRecipientLimit } from '../_email'\nimport type { ResendSendInput, ResendSendOutput } from './contracts'\n\nexport function buildSendPayload(input: ResendSendInput): Record<string, unknown> {\n\treturn {\n\t\t...pick(input, ['subject', 'html', 'text', 'headers']),\n\t\tfrom: addressToString(input.from),\n\t\tto: addressList(input.to),\n\t\tcc: addressList(input.cc),\n\t\tbcc: addressList(input.bcc),\n\t\t...(input.reply_to && { reply_to: addressToString(input.reply_to) }),\n\t\t...(input.attachments && {\n\t\t\tattachments: input.attachments.map((att) => ({\n\t\t\t\tfilename: att.filename,\n\t\t\t\tcontent: att.content,\n\t\t\t\tcontent_type: att.type,\n\t\t\t\t...(att.disposition && { content_disposition: att.disposition }),\n\t\t\t\t// Resend REST uses content_id for CID inline images.\n\t\t\t\t...(att.content_id && { content_id: att.content_id })\n\t\t\t}))\n\t\t})\n\t}\n}\n\nexport function preflightSend(input: ResendSendInput): Record<string, unknown> {\n\tassertRecipientLimit(input)\n\tconst payload = buildSendPayload(input)\n\tassertEmailSize(\n\t\tpayload,\n\t\tinput.attachments?.map((a) => a.content)\n\t)\n\treturn payload\n}\n\n/** Map Resend `{ id }` success body to tool output. */\nexport function parseSendResult(data: unknown): ResendSendOutput {\n\tif (!isPlainObject(data)) {\n\t\tthrow new ToolError('Resend returned an unexpected payload', { code: 'upstream' })\n\t}\n\tconst id = data['id']\n\treturn {\n\t\tsuccess: true,\n\t\t...(isString(id) && id.length > 0 && { id })\n\t}\n}\n","/**\n * Resend vendor client.\n * Host: `new ResendClient(auth)`. Agent tools: `fromContext(ctx)`.\n */\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { runBatchItems } from '../../shared/batch'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport type {\n\tResendAuth,\n\tResendSendBatchInput,\n\tResendSendBatchOutput,\n\tResendSendInput,\n\tResendSendOutput\n} from './contracts'\nimport { resendAuthSchema } from './contracts'\nimport { parseSendResult, preflightSend } from './domain'\n\nexport type ResendClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class ResendClient {\n\treadonly #http: HttpService\n\n\tconstructor(auth: ResendAuth, options: ResendClientOptions = {}) {\n\t\tconst parsed = resendAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Resend 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.#http = new HttpService({\n\t\t\t...options,\n\t\t\tbaseURL: 'https://api.resend.com',\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${parsed.data.api_key}`,\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tlabel: 'Resend'\n\t\t})\n\t}\n\n\tstatic fromContext(ctx: ToolContext): ResendClient {\n\t\tconst auth = requireAuth(ctx, resendAuthSchema)\n\t\treturn new ResendClient(auth, {\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\t/** POST /emails */\n\tasync send(input: ResendSendInput): Promise<ResendSendOutput> {\n\t\tconst payload = preflightSend(input)\n\t\tconst { data } = await this.#http.post('/emails', payload, { label: 'Resend send' })\n\t\treturn parseSendResult(data)\n\t}\n\n\t/** Sequential batch of independent sends (partial failure OK). */\n\tasync sendBatch(input: ResendSendBatchInput): Promise<ResendSendBatchOutput> {\n\t\treturn runBatchItems(input.messages, (message) => this.send(message))\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { ResendClient } from './client'\nimport {\n\tresendAuthSchema,\n\tresendSendBatchInputSchema,\n\tresendSendBatchOutputSchema,\n\tresendSendInputSchema,\n\tresendSendOutputSchema\n} from './contracts'\n\n/** Single-email send tool. Host binds auth via withAuth. */\nexport const resendSendTool = defineTool({\n\tid: 'resend-send',\n\tname: 'resendSend',\n\tdescription:\n\t\t'Send one email via Resend. Subject plus html and/or text. Optional cc, bcc, reply_to, headers, base64 attachments. Total under 5 MiB.',\n\tinputSchema: resendSendInputSchema,\n\toutputSchema: resendSendOutputSchema,\n\tsideEffect: 'send',\n\truntime: 'both',\n\texecute: async (input, ctx) => ResendClient.fromContext(ctx).send(input)\n})\n\n/** Batch send (max 20). Per-message success/error; does not abort the batch. */\nexport const resendSendBatchTool = defineTool({\n\tid: 'resend-send-batch',\n\tname: 'resendSendBatch',\n\tdescription: 'Send up to 20 emails via Resend. Per-message success or error without aborting the batch.',\n\tinputSchema: resendSendBatchInputSchema,\n\toutputSchema: resendSendBatchOutputSchema,\n\tsideEffect: 'send',\n\truntime: 'both',\n\texecute: async (input, ctx) => ResendClient.fromContext(ctx).sendBatch(input)\n})\n\nexport const resendModule = defineModule({\n\tid: 'resend',\n\ttitle: 'Resend',\n\tdescription: 'Resend vendor pack: send one email or a batch (max 20). Not a multi-provider email seam.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: resendAuthSchema },\n\tcategories: ['email'],\n\tclassification: 'pii',\n\ttags: ['send'],\n\ttools: [resendSendTool, resendSendBatchTool]\n})\n"],"mappings":";;;;;;;;;AASA,MAAa,mBAAmB,EAAE,OAAO,EACxC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,gBAAgB,EACrD,CAAC;AAID,MAAa,wBAAwB,EACnC,OAAO;CACP,IAAI,EACF,MAAM,CAAC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACvE,SAAS,+DAA+D;CAC1E,MAAM,mBAAmB,SAAS,+CAA+C;CACjF,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,oBAAoB;CACjE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qCAAqC;CAC1E,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,2CAA2C;CAChF,IAA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S,EAAE,OAAO,IAAI,MAAM;GACpC,GAAI,IAAI,UAAU,EAAE,QAAQ,IAAI,OAAO;EACxC,CAAC;CACF;;CAGA,MAAM,KAAK,OAAmD;EAC7D,MAAM,UAAU,cAAc,KAAK;EACnC,MAAM,EAAE,SAAS,MAAM,KAAKA,MAAM,KAAK,WAAW,SAAS,EAAE,OAAO,cAAc,CAAC;EACnF,OAAO,gBAAgB,IAAI;CAC5B;;CAGA,MAAM,UAAU,OAA6D;EAC5E,OAAO,cAAc,MAAM,WAAW,YAAY,KAAK,KAAK,OAAO,CAAC;CACrE;AACD;;;;ACrDA,MAAa,iBAAiB,WAAW;CACxC,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,KAAK,KAAK;AACxE,CAAC;;AAGD,MAAa,sBAAsB,WAAW;CAC7C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,UAAU,KAAK;AAC7E,CAAC;AAED,MAAa,eAAe,aAAa;CACxC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAiB;CACjD,YAAY,CAAC,OAAO;CACpB,gBAAgB;CAChB,MAAM,CAAC,MAAM;CACb,OAAO,CAAC,gBAAgB,mBAAmB;AAC5C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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-DdFALdNf.js";
|
|
3
3
|
import { n as requireAuth } from "./provider-CgDAlg6K.js";
|
|
4
4
|
import { t as AwsService } from "./aws-service-Cn_ozX4X.js";
|
|
5
5
|
import { a as toArrayBuffer, i as encodeObjectKeyPath, n as bytesToBase64, o as utf8ToBytes, r as bytesToUtf8, t as base64ToBytes } from "./bytes-BxpimpQx.js";
|
|
@@ -952,4 +952,4 @@ const s3Module = defineModule({
|
|
|
952
952
|
//#endregion
|
|
953
953
|
export { getObjectOutputSchema as A, uploadPartOutputSchema as B, copyObjectInputSchema as C, deleteObjectInputSchema as D, createMultipartUploadOutputSchema as E, putObjectInputSchema as F, resolveObjectKey as H, putObjectOutputSchema as I, signedUrlInputSchema as L, headObjectOutputSchema as M, listObjectsInputSchema as N, deleteObjectOutputSchema as O, listObjectsOutputSchema as P, signedUrlOutputSchema as R, completeMultipartUploadOutputSchema as S, createMultipartUploadInputSchema as T, normalizeKeyPrefix as V, MAX_OBJECT_BYTES as _, s3CreateSignedUrlTool as a, abortMultipartUploadOutputSchema as b, s3HeadObjectTool as c, s3PutObjectTool as d, s3UploadPartTool as f, MAX_MULTIPART_PART_BYTES as g, DEFAULT_SIGNED_URL_SECONDS as h, s3CreateMultipartUploadTool as i, headObjectInputSchema as j, getObjectInputSchema as k, s3ListObjectsTool as l, s3AuthSchema as m, s3CompleteMultipartUploadTool as n, s3DeleteObjectTool as o, S3Client as p, s3CopyObjectTool as r, s3GetObjectTool as s, s3AbortMultipartUploadTool as t, s3Module as u, MAX_SIGNED_URL_SECONDS as v, copyObjectOutputSchema as w, completeMultipartUploadInputSchema as x, abortMultipartUploadInputSchema as y, uploadPartInputSchema as z };
|
|
954
954
|
|
|
955
|
-
//# sourceMappingURL=s3-
|
|
955
|
+
//# sourceMappingURL=s3-TKCIZZ2q.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-CoZQRTfe.js","names":["#auth","#aws","#keyPrefix","#resolve","#getBoundedWire","#headWire","#publicKey","#resolveCopySourceKey"],"sources":["../src/vendors/_storage/keys.ts","../src/vendors/_storage/schemas.ts","../src/vendors/s3/contracts.ts","../src/vendors/s3/domain.ts","../src/vendors/s3/client.ts","../src/vendors/s3/module.ts"],"sourcesContent":["/**\n * Object-key prefix helpers for storage vendors (S3, Textract DocumentLocation, …).\n * Logical keys are prefix-relative; wire keys include key_prefix when set.\n */\n\nimport { isToolError, ToolError } from '../../core/errors'\n\n/** S3 object key maximum length (bytes, UTF-8). */\nexport const MAX_OBJECT_KEY_BYTES = 1024\n\nfunction utf8ByteLength(value: string): number {\n\treturn new TextEncoder().encode(value).byteLength\n}\n\nfunction assertKeyByteLimit(wireKey: string): void {\n\tconst bytes = utf8ByteLength(wireKey)\n\tif (bytes > MAX_OBJECT_KEY_BYTES) {\n\t\tthrow new ToolError(`Object key exceeds ${MAX_OBJECT_KEY_BYTES} bytes`, {\n\t\t\tcode: 'bad_input',\n\t\t\tdetails: { max_bytes: MAX_OBJECT_KEY_BYTES, key_bytes: bytes }\n\t\t})\n\t}\n}\n\n/**\n * Split a logical path into segments. Rejects parent segments and leading absolute form.\n * Allows names like `report..final.pdf` (only a segment equal to `..` is rejected).\n */\nfunction keySegments(\n\tvalue: string,\n\toptions: { allowEmpty?: boolean; allowTrailingSlash?: boolean } = {}\n): { segments: string[]; trailingSlash: boolean } {\n\tconst trimmed = value.trim().replaceAll('\\\\', '/')\n\tif (trimmed.startsWith('/')) {\n\t\tthrow new ToolError('Object key must not be absolute (no leading /)', { code: 'bad_input' })\n\t}\n\tconst trailingSlash = trimmed.endsWith('/')\n\tif (trailingSlash && options.allowTrailingSlash !== true) {\n\t\tthrow new ToolError('Object key must not end with /', { code: 'bad_input' })\n\t}\n\tconst segments = trimmed.split('/').filter((segment) => segment.length > 0 && segment !== '.')\n\tfor (const segment of segments) {\n\t\tif (segment === '..') {\n\t\t\tthrow new ToolError('Object key must not contain parent-directory segments', { code: 'bad_input' })\n\t\t}\n\t}\n\tif (segments.length === 0 && !options.allowEmpty && !trailingSlash) {\n\t\tthrow new ToolError('Object key is required', { code: 'bad_input' })\n\t}\n\treturn { segments, trailingSlash }\n}\n\nfunction joinSegments(segments: string[], trailingSlash: boolean): string {\n\tconst joined = segments.join('/')\n\tif (trailingSlash) return joined.length > 0 ? `${joined}/` : ''\n\treturn joined\n}\n\nfunction remapAuthError(error: unknown): never {\n\tif (isToolError(error) && error.code === 'bad_input') {\n\t\tthrow new ToolError(error.message.replace(/^Object key/, 'key_prefix'), {\n\t\t\tcode: 'bad_auth',\n\t\t\t...(error.details !== undefined && { details: error.details }),\n\t\t\tcause: error\n\t\t})\n\t}\n\tthrow error\n}\n\n/** Normalize key_prefix from auth: non-absolute, no `..` segments, always ends with `/`. */\nexport function normalizeKeyPrefix(keyPrefix: string): string {\n\ttry {\n\t\tconst { segments } = keySegments(keyPrefix, { allowEmpty: false, allowTrailingSlash: true })\n\t\tif (segments.length === 0) {\n\t\t\tthrow new ToolError('key_prefix must not be empty', { code: 'bad_auth' })\n\t\t}\n\t\tconst root = `${segments.join('/')}/`\n\t\tassertKeyByteLimit(root)\n\t\treturn root\n\t} catch (error) {\n\t\tremapAuthError(error)\n\t}\n}\n\n/**\n * Resolve a logical object key to a wire key.\n * - No prefix: validated logical key (normalized segments).\n * - With prefix: relative keys are rooted; keys already under the prefix are accepted as-is.\n */\nexport function resolveObjectKey(logicalKey: string, keyPrefix: string | undefined): string {\n\tconst { segments } = keySegments(logicalKey, { allowEmpty: false })\n\tconst logical = joinSegments(segments, false)\n\tif (!keyPrefix) {\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tconst wire = logical.startsWith(keyPrefix) ? logical : `${keyPrefix}${logical}`\n\tassertKeyByteLimit(wire)\n\treturn wire\n}\n\n/**\n * Resolve a list prefix filter under optional key_prefix.\n * Empty / omitted relative → bound prefix root (or undefined when unbound).\n */\nexport function resolveListPrefix(\n\trelativePrefix: string | undefined,\n\tkeyPrefix: string | undefined\n): string | undefined {\n\tif (relativePrefix === undefined || relativePrefix.trim().length === 0) {\n\t\treturn keyPrefix\n\t}\n\tconst { segments, trailingSlash } = keySegments(relativePrefix, {\n\t\tallowEmpty: true,\n\t\tallowTrailingSlash: true\n\t})\n\tconst logical = joinSegments(segments, trailingSlash)\n\tif (!keyPrefix) {\n\t\tif (logical.length === 0) return undefined\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tif (logical.length === 0 || logical === keyPrefix.slice(0, -1) || logical === keyPrefix) {\n\t\treturn keyPrefix\n\t}\n\tif (logical.startsWith(keyPrefix)) {\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tconst wire = `${keyPrefix}${logical}`\n\tassertKeyByteLimit(wire)\n\treturn wire\n}\n\n/**\n * Map a wire key back to a logical (public) key.\n * Returns undefined when the wire key is outside key_prefix (caller should skip/filter).\n */\nexport function toPublicKey(wireKey: string, keyPrefix: string | undefined): string | undefined {\n\tif (!keyPrefix) return wireKey\n\tif (!wireKey.startsWith(keyPrefix)) return undefined\n\treturn wireKey.slice(keyPrefix.length)\n}\n","/**\n * Shared object-store I/O schemas for the s3 vendor pack (and nested S3 bindings).\n * Not published — `_storage` is skipped by codegen.\n */\n\nimport { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\n\nexport const MAX_OBJECT_BYTES = 5 * 1024 * 1024\nexport const DEFAULT_SIGNED_URL_SECONDS = 3600\nexport const MAX_SIGNED_URL_SECONDS = 7 * 24 * 3600\nexport const MAX_BATCH_ITEMS = 25\nexport const MAX_MULTIPART_PART_BYTES = 25 * 1024 * 1024\n\nexport const listedObjectSchema = z.object({\n\tkey: z.string(),\n\tsize: z.number().optional(),\n\tlast_modified: z.string().optional(),\n\tetag: z.string().optional()\n})\n\nexport const listObjectsInputSchema = z.object({\n\tprefix: z.string().optional().describe('Key prefix filter'),\n\tdelimiter: z.string().optional().describe('Delimiter for common prefixes (folders), for example /'),\n\tcursor: z.string().min(1).optional().describe('Pagination cursor from a prior list call'),\n\tlimit: z.int().min(1).max(1000).optional().describe('Maximum keys to return (1-1000)')\n})\n\nexport const listObjectsOutputSchema = z.object({\n\tkeys: z.array(z.string()).describe('Object keys (convenience list)'),\n\titems: z.array(listedObjectSchema).describe('Objects with size, last_modified, and etag when present'),\n\tcommon_prefixes: z.array(z.string()).optional().describe('Common prefixes when delimiter is set'),\n\tnext_cursor: z.string().optional().describe('Pass as cursor to fetch the next page'),\n\ttruncated: z.boolean().describe('Whether more results exist')\n})\n\nexport const getObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to download'),\n\tencoding: z.enum(['base64', 'utf8']).optional().describe('Body encoding. Defaults to base64 for binary safety')\n})\n\nexport const getObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tcontent_type: z.string().optional(),\n\tcontent_length: z.number().optional(),\n\tbody: z.string().describe('Object body encoded per encoding input'),\n\tencoding: z.enum(['base64', 'utf8'])\n})\n\nexport const putObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to write'),\n\tbody: z.string().describe('Object body as utf8 text or base64 (see body_encoding)'),\n\tbody_encoding: z.enum(['utf8', 'base64']).optional().describe('How to interpret body. Defaults to utf8'),\n\tcontent_type: z.string().optional().describe('Content-Type header to store')\n})\n\nexport const putObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tetag: z.string().optional(),\n\tcontent_length: z.number().describe('Decoded body byte length uploaded')\n})\n\nexport const deleteObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to delete')\n})\n\nexport const deleteObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tdeleted: z.boolean()\n})\n\nexport const headObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to inspect')\n})\n\nexport const headObjectOutputSchema = z.object({\n\tkey: z.string(),\n\texists: z.boolean(),\n\tcontent_type: z.string().optional(),\n\tcontent_length: z.number().optional(),\n\tetag: z.string().optional()\n})\n\nexport const copyObjectInputSchema = z.object({\n\tsource_key: z.string().min(1).describe('Source object key to copy from'),\n\tdestination_key: z.string().min(1).describe('Destination object key to copy to'),\n\tsource_bucket: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe('Optional source bucket when different from the configured default bucket')\n})\n\nexport const copyObjectOutputSchema = z.object({\n\tsource_key: z.string(),\n\tdestination_key: z.string(),\n\tetag: z.string().optional()\n})\n\nexport const signedUrlInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to sign'),\n\tmethod: z\n\t\t.enum(['GET', 'PUT', 'HEAD', 'DELETE'])\n\t\t.optional()\n\t\t.describe('HTTP method the URL authorizes. Defaults to GET'),\n\texpires_in: z\n\t\t.int()\n\t\t.min(1)\n\t\t.max(MAX_SIGNED_URL_SECONDS)\n\t\t.optional()\n\t\t.describe('URL lifetime in seconds (1 to 604800). Defaults to 3600')\n})\n\nexport const signedUrlOutputSchema = z.object({\n\turl: z.url().describe('Presigned URL'),\n\tmethod: z.enum(['GET', 'PUT', 'HEAD', 'DELETE']),\n\texpires_in: z.int().describe('Lifetime in seconds used when signing')\n})\n\nexport const createMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to create via multipart upload'),\n\tcontent_type: z.string().optional().describe('Content-Type stored on the completed object')\n})\n\nexport const createMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string().min(1).describe('Upload id required for subsequent part/complete/abort calls')\n})\n\nexport const uploadPartInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload'),\n\tpart_number: z.int().min(1).max(10_000).describe('Part number (1-10000). Must be unique within the upload'),\n\tbody: z.string().describe('Part body as utf8 text or base64 (see body_encoding)'),\n\tbody_encoding: z.enum(['utf8', 'base64']).optional().describe('How to interpret body. Defaults to utf8')\n})\n\nexport const uploadPartOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\tpart_number: z.int(),\n\tetag: z.string().min(1).describe('Part ETag required when completing the multipart upload'),\n\tcontent_length: z.number().describe('Decoded part byte length uploaded')\n})\n\nexport const multipartUploadedPartSchema = z.object({\n\tpart_number: z.int().min(1).max(10_000).describe('Uploaded part number from s3-upload-part'),\n\tetag: z.string().min(1).describe('ETag returned by uploadPart (with or without surrounding quotes)')\n})\n\nexport const completeMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload'),\n\tparts: z\n\t\t.array(multipartUploadedPartSchema)\n\t\t.min(1)\n\t\t.max(10_000)\n\t\t.describe('Uploaded parts with part_number and etag, in any order (sorted before complete)')\n})\n\nexport const completeMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\tetag: z.string().optional().describe('Final object ETag when the store returns one')\n})\n\nexport const abortMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload')\n})\n\nexport const abortMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\taborted: z.boolean()\n})\n\nexport const getObjectsInputSchema = z.object({\n\tkeys: z.array(z.string().min(1)).min(1).max(MAX_BATCH_ITEMS).describe('Object keys to download'),\n\tencoding: z.enum(['base64', 'utf8']).optional().describe('Body encoding for each item. Defaults to base64')\n})\n\nexport const putObjectsInputSchema = z.object({\n\tobjects: z.array(putObjectInputSchema).min(1).max(MAX_BATCH_ITEMS).describe('Objects to upload')\n})\n\nexport const deleteObjectsInputSchema = z.object({\n\tkeys: z.array(z.string().min(1)).min(1).max(MAX_BATCH_ITEMS).describe('Object keys to delete')\n})\n\nexport const getObjectsOutputSchema = batchResultSchema(getObjectOutputSchema)\nexport const putObjectsOutputSchema = batchResultSchema(putObjectOutputSchema)\nexport const deleteObjectsOutputSchema = batchResultSchema(deleteObjectOutputSchema)\n\nexport type ListObjectsInput = z.infer<typeof listObjectsInputSchema>\nexport type ListObjectsOutput = z.infer<typeof listObjectsOutputSchema>\nexport type GetObjectInput = z.infer<typeof getObjectInputSchema>\nexport type GetObjectOutput = z.infer<typeof getObjectOutputSchema>\nexport type PutObjectInput = z.infer<typeof putObjectInputSchema>\nexport type PutObjectOutput = z.infer<typeof putObjectOutputSchema>\nexport type DeleteObjectInput = z.infer<typeof deleteObjectInputSchema>\nexport type DeleteObjectOutput = z.infer<typeof deleteObjectOutputSchema>\nexport type HeadObjectInput = z.infer<typeof headObjectInputSchema>\nexport type HeadObjectOutput = z.infer<typeof headObjectOutputSchema>\nexport type CopyObjectInput = z.infer<typeof copyObjectInputSchema>\nexport type CopyObjectOutput = z.infer<typeof copyObjectOutputSchema>\nexport type SignedUrlInput = z.infer<typeof signedUrlInputSchema>\nexport type SignedUrlOutput = z.infer<typeof signedUrlOutputSchema>\nexport type CreateMultipartUploadInput = z.infer<typeof createMultipartUploadInputSchema>\nexport type CreateMultipartUploadOutput = z.infer<typeof createMultipartUploadOutputSchema>\nexport type UploadPartInput = z.infer<typeof uploadPartInputSchema>\nexport type UploadPartOutput = z.infer<typeof uploadPartOutputSchema>\nexport type CompleteMultipartUploadInput = z.infer<typeof completeMultipartUploadInputSchema>\nexport type CompleteMultipartUploadOutput = z.infer<typeof completeMultipartUploadOutputSchema>\nexport type AbortMultipartUploadInput = z.infer<typeof abortMultipartUploadInputSchema>\nexport type AbortMultipartUploadOutput = z.infer<typeof abortMultipartUploadOutputSchema>\n","/**\n * S3 / S3-compatible vendor auth + re-exports of shared object-store I/O.\n */\n\nimport { z } from 'zod'\n\nexport {\n\tabortMultipartUploadInputSchema,\n\tabortMultipartUploadOutputSchema,\n\tcompleteMultipartUploadInputSchema,\n\tcompleteMultipartUploadOutputSchema,\n\tcopyObjectInputSchema,\n\tcopyObjectOutputSchema,\n\tcreateMultipartUploadInputSchema,\n\tcreateMultipartUploadOutputSchema,\n\tDEFAULT_SIGNED_URL_SECONDS,\n\tdeleteObjectInputSchema,\n\tdeleteObjectOutputSchema,\n\tgetObjectInputSchema,\n\tgetObjectOutputSchema,\n\theadObjectInputSchema,\n\theadObjectOutputSchema,\n\tlistObjectsInputSchema,\n\tlistObjectsOutputSchema,\n\tlistedObjectSchema,\n\tMAX_MULTIPART_PART_BYTES,\n\tMAX_OBJECT_BYTES,\n\tMAX_SIGNED_URL_SECONDS,\n\tmultipartUploadedPartSchema,\n\tputObjectInputSchema,\n\tputObjectOutputSchema,\n\tsignedUrlInputSchema,\n\tsignedUrlOutputSchema,\n\tuploadPartInputSchema,\n\tuploadPartOutputSchema\n} from '../_storage'\nexport type {\n\tAbortMultipartUploadInput,\n\tAbortMultipartUploadOutput,\n\tCompleteMultipartUploadInput,\n\tCompleteMultipartUploadOutput,\n\tCopyObjectInput,\n\tCopyObjectOutput,\n\tCreateMultipartUploadInput,\n\tCreateMultipartUploadOutput,\n\tDeleteObjectInput,\n\tDeleteObjectOutput,\n\tGetObjectInput,\n\tGetObjectOutput,\n\tHeadObjectInput,\n\tHeadObjectOutput,\n\tListObjectsInput,\n\tListObjectsOutput,\n\tPutObjectInput,\n\tPutObjectOutput,\n\tSignedUrlInput,\n\tSignedUrlOutput,\n\tUploadPartInput,\n\tUploadPartOutput\n} from '../_storage'\n\nexport const s3AuthSchema = z.object({\n\taccess_key_id: z.string().min(1).describe('S3 access key id'),\n\tsecret_access_key: z.string().min(1).describe('S3 secret access key'),\n\tregion: z.string().min(1).describe('AWS region, or auto / us-east-1 for R2 S3 endpoint'),\n\tbucket: z.string().min(1).describe('Default bucket name'),\n\tendpoint: z\n\t\t.url()\n\t\t.optional()\n\t\t.describe('S3-compatible endpoint when not AWS (R2: https://<account_id>.r2.cloudflarestorage.com, MinIO, …)'),\n\tsession_token: z.string().min(1).optional().describe('Optional session token for temporary credentials'),\n\tkey_prefix: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Optional object-key root for this binding (no leading slash). Logical keys are relative to this prefix; wire keys include it. Host tenant scoping binds once here.'\n\t\t)\n})\n\nexport type S3Auth = z.infer<typeof s3AuthSchema>\n","/**\n * S3 URL building + XML response parse (fast-xml-parser).\n */\n\nimport { isPlainObject, isString } from 'es-toolkit'\nimport { isArray } from 'es-toolkit/compat'\nimport { XMLParser } from 'fast-xml-parser'\n\nimport { encodeObjectKeyPath } from '../../shared/bytes'\nimport type { S3Auth } from './contracts'\n\nexport type ListedObject = {\n\tkey: string\n\tsize?: number\n\tlast_modified?: string\n\tetag?: string\n}\n\nexport type ParsedListResult = {\n\titems: ListedObject[]\n\ttruncated: boolean\n\tnext_cursor?: string\n\tcommon_prefixes?: string[]\n}\n\nconst listParser = new XMLParser({\n\tignoreAttributes: true,\n\ttrimValues: true,\n\t// Always arrays so single Contents/CommonPrefixes match multi-item shape\n\tisArray: (name) => name === 'Contents' || name === 'CommonPrefixes'\n})\n\nconst genericParser = new XMLParser({\n\tignoreAttributes: true,\n\ttrimValues: true\n})\n\nexport function objectUrl(auth: S3Auth, key: string, query?: string): string {\n\tconst encodedKey = encodeObjectKeyPath(key)\n\tconst base = auth.endpoint\n\t\t? `${auth.endpoint.replace(/\\/+$/, '')}/${encodeURIComponent(auth.bucket)}/${encodedKey}`\n\t\t: `https://${auth.bucket}.s3.${auth.region}.amazonaws.com/${encodedKey}`\n\treturn query ? `${base}?${query}` : base\n}\n\nexport function listUrl(auth: S3Auth, params: URLSearchParams): string {\n\tconst base = auth.endpoint\n\t\t? `${auth.endpoint.replace(/\\/+$/, '')}/${encodeURIComponent(auth.bucket)}`\n\t\t: `https://${auth.bucket}.s3.${auth.region}.amazonaws.com`\n\tconst qs = params.toString()\n\treturn qs ? `${base}?${qs}` : base\n}\n\nexport function copySourceHeader(auth: S3Auth, sourceKey: string, sourceBucket?: string): string {\n\tconst bucket = sourceBucket ?? auth.bucket\n\treturn `/${encodeURIComponent(bucket)}/${encodeObjectKeyPath(sourceKey)}`\n}\n\nexport function stripEtagQuotes(etag: string): string {\n\treturn etag.replaceAll('\"', '')\n}\n\n/** Parse `Content-Range: bytes start-end/total` → total object size when known. */\nexport function contentRangeTotal(header: string | null): number | undefined {\n\tif (header === null || header.length === 0) return undefined\n\tconst slash = header.lastIndexOf('/')\n\tif (slash < 0) return undefined\n\tconst totalRaw = header.slice(slash + 1).trim()\n\tif (totalRaw === '*' || totalRaw.length === 0) return undefined\n\tconst total = Number.parseInt(totalRaw, 10)\n\treturn Number.isFinite(total) ? total : undefined\n}\n\nfunction asArray(value: unknown): unknown[] {\n\tif (value === undefined || value === null) return []\n\treturn isArray(value) ? value : [value]\n}\n\nfunction textValue(value: unknown): string | undefined {\n\tif (isString(value) && value.length > 0) return value\n\tif (typeof value === 'number' && Number.isFinite(value)) return String(value)\n\tif (typeof value === 'boolean') return value ? 'true' : 'false'\n\treturn undefined\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\tif (typeof value === 'number' && Number.isFinite(value)) return value\n\tif (isString(value) && value.length > 0) {\n\t\tconst n = Number.parseInt(value, 10)\n\t\treturn Number.isFinite(n) ? n : undefined\n\t}\n\treturn undefined\n}\n\n/** Parse ListObjectsV2 XML into list items + pagination. */\nexport function parseListResult(xml: string): ParsedListResult {\n\tconst doc: unknown = listParser.parse(xml)\n\tconst root =\n\t\tisPlainObject(doc) && isPlainObject(doc['ListBucketResult'])\n\t\t\t? doc['ListBucketResult']\n\t\t\t: isPlainObject(doc)\n\t\t\t\t? doc\n\t\t\t\t: null\n\tif (!root) {\n\t\treturn { items: [], truncated: false }\n\t}\n\n\tconst items: ListedObject[] = []\n\tfor (const row of asArray(root['Contents'])) {\n\t\tif (!isPlainObject(row)) continue\n\t\tconst key = textValue(row['Key'])\n\t\tif (!key) continue\n\t\tconst size = numberValue(row['Size'])\n\t\tconst last_modified = textValue(row['LastModified'])\n\t\tconst etagRaw = textValue(row['ETag'])\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : undefined\n\t\titems.push({\n\t\t\tkey,\n\t\t\t...(size !== undefined && { size }),\n\t\t\t...(last_modified && { last_modified }),\n\t\t\t...(etag && { etag })\n\t\t})\n\t}\n\n\tconst truncatedRaw = root['IsTruncated']\n\tconst truncated =\n\t\ttruncatedRaw === true ||\n\t\ttruncatedRaw === 'true' ||\n\t\t(isString(truncatedRaw) && truncatedRaw.toLowerCase() === 'true')\n\n\tconst next = textValue(root['NextContinuationToken'])\n\tconst common_prefixes: string[] = []\n\tfor (const row of asArray(root['CommonPrefixes'])) {\n\t\tif (!isPlainObject(row)) continue\n\t\tconst prefix = textValue(row['Prefix'])\n\t\tif (prefix) common_prefixes.push(prefix)\n\t}\n\n\treturn {\n\t\titems,\n\t\ttruncated,\n\t\t...(next && { next_cursor: next }),\n\t\t...(common_prefixes.length > 0 && { common_prefixes })\n\t}\n}\n\n/** First text value for a tag anywhere in a small S3 XML body (ETag, UploadId, …). */\nexport function firstXmlText(xml: string, tag: string): string | undefined {\n\tconst doc: unknown = genericParser.parse(xml)\n\treturn findTagText(doc, tag)\n}\n\nfunction findTagText(node: unknown, tag: string): string | undefined {\n\tif (!isPlainObject(node)) return undefined\n\tif (Object.hasOwn(node, tag)) {\n\t\tconst direct = textValue(node[tag])\n\t\tif (direct) return direct\n\t}\n\tfor (const value of Object.values(node)) {\n\t\tconst found = findTagText(value, tag)\n\t\tif (found) return found\n\t}\n\treturn undefined\n}\n","/**\n * S3 / S3-compatible object-store client (AwsService SigV4).\n * Host: `new S3Client(auth)`. Agent tools: `fromContext(ctx)`.\n *\n * When auth.key_prefix is set, public API keys are logical (prefix-relative);\n * wire keys always include the prefix. Resolve once; private methods take wire keys.\n */\n\nimport { isNil, isNumber, isString } from 'es-toolkit'\n\nimport { isToolError, ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { base64ToBytes, bytesToBase64, bytesToUtf8, toArrayBuffer, utf8ToBytes } from '../../shared/bytes'\nimport { AwsService } from '../../transport/aws-service'\nimport type { AwsServiceOptions } from '../../transport/aws-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport { normalizeKeyPrefix, resolveListPrefix, resolveObjectKey, toPublicKey } from '../_storage'\nimport type {\n\tAbortMultipartUploadInput,\n\tAbortMultipartUploadOutput,\n\tCompleteMultipartUploadInput,\n\tCompleteMultipartUploadOutput,\n\tCopyObjectInput,\n\tCopyObjectOutput,\n\tCreateMultipartUploadInput,\n\tCreateMultipartUploadOutput,\n\tDeleteObjectInput,\n\tDeleteObjectOutput,\n\tGetObjectInput,\n\tGetObjectOutput,\n\tHeadObjectInput,\n\tHeadObjectOutput,\n\tListObjectsInput,\n\tListObjectsOutput,\n\tPutObjectInput,\n\tPutObjectOutput,\n\tS3Auth,\n\tSignedUrlInput,\n\tSignedUrlOutput,\n\tUploadPartInput,\n\tUploadPartOutput\n} from './contracts'\nimport { DEFAULT_SIGNED_URL_SECONDS, MAX_MULTIPART_PART_BYTES, MAX_OBJECT_BYTES, s3AuthSchema } from './contracts'\nimport {\n\tcontentRangeTotal,\n\tcopySourceHeader,\n\tfirstXmlText,\n\tlistUrl,\n\tobjectUrl,\n\tparseListResult,\n\tstripEtagQuotes\n} from './domain'\n\nexport type S3ClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport type S3ByteRange = {\n\tstart_byte: number\n\tend_byte: number\n}\n\nexport type S3ByteRangeResult = {\n\tbytes: Uint8Array\n\tstart_byte: number\n\tend_byte: number\n\ttotal_bytes?: number | undefined\n\tcontent_type?: string | undefined\n}\n\nfunction objectNotFound(): never {\n\tthrow new ToolError('Object not found', { code: 'not_found' })\n}\n\nfunction remapNotFound(error: unknown): never {\n\tif (isToolError(error) && error.code === 'not_found') objectNotFound()\n\tthrow error\n}\n\nfunction tooLarge(maxBytes: number, contentLength: number, message: string, cause?: unknown): never {\n\tthrow new ToolError(message, {\n\t\tcode: 'too_large',\n\t\tdetails: { max_bytes: maxBytes, content_length: contentLength },\n\t\t...(cause !== undefined && { cause })\n\t})\n}\n\nfunction assertByteLimit(maxBytes: number): void {\n\tif (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {\n\t\tthrow new ToolError('Download limit must be a non-negative safe integer', { code: 'bad_input' })\n\t}\n}\n\nexport class S3Client {\n\treadonly #auth: S3Auth\n\treadonly #aws: AwsService\n\t/** Normalized key_prefix with trailing `/`, or undefined when unbound. */\n\treadonly #keyPrefix: string | undefined\n\n\tconstructor(auth: S3Auth, options: S3ClientOptions = {}) {\n\t\tconst parsed = s3AuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid S3 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.#auth = parsed.data\n\t\tthis.#keyPrefix = parsed.data.key_prefix !== undefined ? normalizeKeyPrefix(parsed.data.key_prefix) : undefined\n\n\t\tconst awsOptions: AwsServiceOptions = {\n\t\t\taccessKeyId: this.#auth.access_key_id,\n\t\t\tsecretAccessKey: this.#auth.secret_access_key,\n\t\t\tregion: this.#auth.region,\n\t\t\tservice: 's3',\n\t\t\tlabel: 'S3'\n\t\t}\n\t\tif (options.fetch) awsOptions.fetch = options.fetch\n\t\tif (options.signal) awsOptions.signal = options.signal\n\t\tif (this.#auth.session_token) awsOptions.sessionToken = this.#auth.session_token\n\t\tthis.#aws = new AwsService(awsOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): S3Client {\n\t\tconst auth = requireAuth(ctx, s3AuthSchema)\n\t\tconst options: S3ClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new S3Client(auth, options)\n\t}\n\n\t#resolve(logicalKey: string): string {\n\t\treturn resolveObjectKey(logicalKey, this.#keyPrefix)\n\t}\n\n\t#publicKey(wireKey: string): string {\n\t\tconst publicKey = toPublicKey(wireKey, this.#keyPrefix)\n\t\tif (publicKey === undefined) {\n\t\t\tthrow new ToolError('Object key is outside the bound key_prefix', { code: 'bad_input' })\n\t\t}\n\t\treturn publicKey\n\t}\n\n\t/** Source key for copy: scoped only when same bucket as this client. */\n\t#resolveCopySourceKey(sourceKey: string, sourceBucket: string | undefined): string {\n\t\tconst sameBucket = sourceBucket === undefined || sourceBucket === this.#auth.bucket\n\t\tif (sameBucket) return this.#resolve(sourceKey)\n\t\t// Foreign bucket: validate shape only; do not apply this binding's key_prefix.\n\t\treturn resolveObjectKey(sourceKey, undefined)\n\t}\n\n\tasync list(input: ListObjectsInput): Promise<ListObjectsOutput> {\n\t\tconst prefix = resolveListPrefix(input.prefix, this.#keyPrefix)\n\t\tconst params = new URLSearchParams({ 'list-type': '2' })\n\t\tif (prefix !== undefined) params.set('prefix', prefix)\n\t\tif (input.delimiter) params.set('delimiter', input.delimiter)\n\t\tif (input.cursor) params.set('continuation-token', input.cursor)\n\t\tif (input.limit !== undefined) params.set('max-keys', String(input.limit))\n\n\t\tconst { bytes } = await this.#aws.bytes('GET', listUrl(this.#auth, params), { label: 'S3 list' })\n\t\tconst listed = parseListResult(bytesToUtf8(bytes))\n\n\t\tconst items = []\n\t\tconst keys: string[] = []\n\t\tfor (const obj of listed.items) {\n\t\t\tconst publicKey = toPublicKey(obj.key, this.#keyPrefix)\n\t\t\tif (publicKey === undefined) continue\n\t\t\tkeys.push(publicKey)\n\t\t\titems.push({\n\t\t\t\tkey: publicKey,\n\t\t\t\t...(obj.size !== undefined && { size: obj.size }),\n\t\t\t\t...(obj.last_modified && { last_modified: obj.last_modified }),\n\t\t\t\t...(obj.etag && { etag: obj.etag })\n\t\t\t})\n\t\t}\n\n\t\tconst out: ListObjectsOutput = {\n\t\t\tkeys,\n\t\t\titems,\n\t\t\ttruncated: listed.truncated\n\t\t}\n\t\tif (listed.common_prefixes && listed.common_prefixes.length > 0) {\n\t\t\tconst common: string[] = []\n\t\t\tfor (const folderAbs of listed.common_prefixes) {\n\t\t\t\tconst publicPrefix = toPublicKey(folderAbs, this.#keyPrefix)\n\t\t\t\tif (publicPrefix !== undefined) common.push(publicPrefix)\n\t\t\t}\n\t\t\tif (common.length > 0) out.common_prefixes = common\n\t\t}\n\t\tif (listed.next_cursor) out.next_cursor = listed.next_cursor\n\t\treturn out\n\t}\n\n\t/** HEAD size gate plus a bounded Range GET (wire key only). */\n\tasync #getBoundedWire(\n\t\twireKey: string,\n\t\tmaxBytes: number,\n\t\tlimitMessage: string\n\t): Promise<{ bytes: Uint8Array; headers: Headers; head: HeadObjectOutput }> {\n\t\tassertByteLimit(maxBytes)\n\t\tconst head = await this.#headWire(wireKey)\n\t\tif (!head.exists) objectNotFound()\n\t\tif (!isNil(head.content_length) && head.content_length > maxBytes) {\n\t\t\ttooLarge(maxBytes, head.content_length, limitMessage)\n\t\t}\n\t\tif (head.content_length === 0) {\n\t\t\tconst headers = new Headers({ 'content-length': '0' })\n\t\t\tif (head.content_type) headers.set('content-type', head.content_type)\n\t\t\tif (head.etag) headers.set('etag', `\"${head.etag}\"`)\n\t\t\treturn { bytes: new Uint8Array(), headers, head }\n\t\t}\n\n\t\tconst headers: Record<string, string> = { Range: `bytes=0-${maxBytes}` }\n\t\tif (head.etag) headers['If-Match'] = head.etag.startsWith('\"') ? head.etag : `\"${head.etag}\"`\n\n\t\tlet response\n\t\ttry {\n\t\t\tresponse = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), {\n\t\t\t\tlabel: 'S3 get',\n\t\t\t\theaders,\n\t\t\t\tmaxBytes\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tif (isToolError(error) && error.code === 'too_large') {\n\t\t\t\tconst observed = error.details?.['content_length']\n\t\t\t\ttooLarge(\n\t\t\t\t\tmaxBytes,\n\t\t\t\t\tisNumber(observed) && Number.isFinite(observed) ? observed : maxBytes + 1,\n\t\t\t\t\tlimitMessage,\n\t\t\t\t\terror\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (isToolError(error) && error.details?.['status'] === 412) {\n\t\t\t\tthrow new ToolError('Object changed during download', {\n\t\t\t\t\tcode: 'upstream',\n\t\t\t\t\tdetails: { status: 412, key: this.#publicKey(wireKey) },\n\t\t\t\t\tcause: error\n\t\t\t\t})\n\t\t\t}\n\t\t\tremapNotFound(error)\n\t\t}\n\n\t\tconst total = contentRangeTotal(response.headers.get('content-range'))\n\t\tif (total !== undefined && total > maxBytes) tooLarge(maxBytes, total, limitMessage)\n\t\treturn { bytes: response.bytes, headers: response.headers, head }\n\t}\n\n\tasync #headWire(wireKey: string): Promise<HeadObjectOutput> {\n\t\tconst response = await this.#aws.head(objectUrl(this.#auth, wireKey), {\n\t\t\tlabel: 'S3 head',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\tconst publicKey = this.#publicKey(wireKey)\n\t\tif (response.status === 404) {\n\t\t\treturn { key: publicKey, exists: false }\n\t\t}\n\t\tconst contentType = response.headers.get('content-type')\n\t\tconst lengthHeader = response.headers.get('content-length')\n\t\tconst etag = response.headers.get('etag')\n\t\tconst contentLength = isString(lengthHeader) ? Number.parseInt(lengthHeader, 10) : undefined\n\t\tconst out: HeadObjectOutput = {\n\t\t\tkey: publicKey,\n\t\t\texists: true\n\t\t}\n\t\tif (isString(contentType)) out.content_type = contentType\n\t\tif (!isNil(contentLength) && Number.isFinite(contentLength)) out.content_length = contentLength\n\t\tif (isString(etag)) out.etag = stripEtagQuotes(etag)\n\t\treturn out\n\t}\n\n\tasync get(input: GetObjectInput): Promise<GetObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst {\n\t\t\tbytes: bodyBytes,\n\t\t\theaders: responseHeaders,\n\t\t\thead\n\t\t} = await this.#getBoundedWire(wireKey, MAX_OBJECT_BYTES, 'Object exceeds 5 MiB download limit')\n\t\tconst encoding = input.encoding ?? 'base64'\n\t\tconst body = encoding === 'utf8' ? bytesToUtf8(bodyBytes) : bytesToBase64(bodyBytes)\n\t\tconst contentType = responseHeaders.get('content-type') ?? head.content_type\n\t\tconst lengthHeader = responseHeaders.get('content-length')\n\t\tconst contentLength = isString(lengthHeader) ? Number.parseInt(lengthHeader, 10) : head.content_length\n\t\tconst out: GetObjectOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tbody,\n\t\t\tencoding\n\t\t}\n\t\tif (isString(contentType)) out.content_type = contentType\n\t\t// Prefer HEAD length (full object); Range responses report partial Content-Length.\n\t\tout.content_length =\n\t\t\t!isNil(head.content_length) && Number.isFinite(head.content_length)\n\t\t\t\t? head.content_length\n\t\t\t\t: isNil(contentLength) || !Number.isFinite(contentLength)\n\t\t\t\t\t? bodyBytes.byteLength\n\t\t\t\t\t: contentLength\n\t\treturn out\n\t}\n\n\tasync put(input: PutObjectInput): Promise<PutObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst encoding = input.body_encoding ?? 'utf8'\n\t\tconst bodyBytes = encoding === 'base64' ? base64ToBytes(input.body) : utf8ToBytes(input.body)\n\t\tif (bodyBytes.byteLength > MAX_OBJECT_BYTES) {\n\t\t\tthrow new ToolError('Object exceeds 5 MiB upload limit', {\n\t\t\t\tcode: 'too_large',\n\t\t\t\tdetails: { max_bytes: MAX_OBJECT_BYTES, content_length: bodyBytes.byteLength }\n\t\t\t})\n\t\t}\n\t\tconst headers: Record<string, string> = {}\n\t\tif (input.content_type) headers['Content-Type'] = input.content_type\n\n\t\tconst response = await this.#aws.put(objectUrl(this.#auth, wireKey), toArrayBuffer(bodyBytes), {\n\t\t\tlabel: 'S3 put',\n\t\t\theaders\n\t\t})\n\t\tconst etag = response.headers.get('etag')\n\t\tconst out: PutObjectOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tcontent_length: bodyBytes.byteLength\n\t\t}\n\t\tif (isString(etag)) out.etag = stripEtagQuotes(etag)\n\t\treturn out\n\t}\n\n\tasync delete(input: DeleteObjectInput): Promise<DeleteObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tawait this.#aws.delete(objectUrl(this.#auth, wireKey), {\n\t\t\tlabel: 'S3 delete',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\treturn { key: this.#publicKey(wireKey), deleted: true }\n\t}\n\n\tasync head(input: HeadObjectInput): Promise<HeadObjectOutput> {\n\t\treturn this.#headWire(this.#resolve(input.key))\n\t}\n\n\tasync copy(input: CopyObjectInput): Promise<CopyObjectOutput> {\n\t\tconst destWire = this.#resolve(input.destination_key)\n\t\tconst sourceWire = this.#resolveCopySourceKey(input.source_key, input.source_bucket)\n\t\tconst response = await this.#aws.bytes('PUT', objectUrl(this.#auth, destWire), {\n\t\t\tlabel: 'S3 copy',\n\t\t\theaders: {\n\t\t\t\t'x-amz-copy-source': copySourceHeader(this.#auth, sourceWire, input.source_bucket)\n\t\t\t}\n\t\t})\n\t\tconst xml = bytesToUtf8(response.bytes)\n\t\tconst etagRaw = firstXmlText(xml, 'ETag')\n\t\tconst headerEtag = response.headers.get('etag')\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : isString(headerEtag) ? stripEtagQuotes(headerEtag) : undefined\n\t\tconst out: CopyObjectOutput = {\n\t\t\tsource_key:\n\t\t\t\tinput.source_bucket === undefined || input.source_bucket === this.#auth.bucket\n\t\t\t\t\t? this.#publicKey(sourceWire)\n\t\t\t\t\t: sourceWire,\n\t\t\tdestination_key: this.#publicKey(destWire)\n\t\t}\n\t\tif (etag) out.etag = etag\n\t\treturn out\n\t}\n\n\tasync createSignedUrl(input: SignedUrlInput): Promise<SignedUrlOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst method = input.method ?? 'GET'\n\t\tconst expiresIn = input.expires_in ?? DEFAULT_SIGNED_URL_SECONDS\n\t\tconst url = objectUrl(this.#auth, wireKey, `X-Amz-Expires=${expiresIn}`)\n\t\tconst signed = await this.#aws.sign(url, {\n\t\t\tmethod,\n\t\t\tsignQuery: true\n\t\t})\n\t\treturn {\n\t\t\turl: signed.url,\n\t\t\tmethod,\n\t\t\texpires_in: expiresIn\n\t\t}\n\t}\n\n\tasync createMultipartUpload(input: CreateMultipartUploadInput): Promise<CreateMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst headers: Record<string, string> = {}\n\t\tif (input.content_type) headers['Content-Type'] = input.content_type\n\t\tconst { bytes } = await this.#aws.bytes('POST', objectUrl(this.#auth, wireKey, 'uploads'), {\n\t\t\tlabel: 'S3 create multipart upload',\n\t\t\theaders\n\t\t})\n\t\tconst uploadIdRaw = firstXmlText(bytesToUtf8(bytes), 'UploadId')\n\t\tif (!uploadIdRaw) {\n\t\t\tthrow new ToolError('S3 create multipart upload returned no UploadId', { code: 'upstream' })\n\t\t}\n\t\treturn {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: uploadIdRaw\n\t\t}\n\t}\n\n\tasync uploadPart(input: UploadPartInput): Promise<UploadPartOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst encoding = input.body_encoding ?? 'utf8'\n\t\tconst bodyBytes = encoding === 'base64' ? base64ToBytes(input.body) : utf8ToBytes(input.body)\n\t\tif (bodyBytes.byteLength > MAX_MULTIPART_PART_BYTES) {\n\t\t\tthrow new ToolError('Multipart part exceeds 25 MiB upload limit', {\n\t\t\t\tcode: 'too_large',\n\t\t\t\tdetails: { max_bytes: MAX_MULTIPART_PART_BYTES, content_length: bodyBytes.byteLength }\n\t\t\t})\n\t\t}\n\t\tif (bodyBytes.byteLength === 0) {\n\t\t\tthrow new ToolError('Multipart part body must not be empty', { code: 'bad_input' })\n\t\t}\n\t\tconst query = new URLSearchParams({\n\t\t\tpartNumber: String(input.part_number),\n\t\t\tuploadId: input.upload_id\n\t\t})\n\t\tconst response = await this.#aws.put(objectUrl(this.#auth, wireKey, query.toString()), toArrayBuffer(bodyBytes), {\n\t\t\tlabel: 'S3 upload part'\n\t\t})\n\t\tconst etagHeader = response.headers.get('etag')\n\t\tif (!isString(etagHeader) || etagHeader.length === 0) {\n\t\t\tthrow new ToolError('S3 upload part returned no ETag', { code: 'upstream' })\n\t\t}\n\t\treturn {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: input.upload_id,\n\t\t\tpart_number: input.part_number,\n\t\t\tetag: stripEtagQuotes(etagHeader),\n\t\t\tcontent_length: bodyBytes.byteLength\n\t\t}\n\t}\n\n\tasync completeMultipartUpload(input: CompleteMultipartUploadInput): Promise<CompleteMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst sorted = [...input.parts].sort((a, b) => a.part_number - b.part_number)\n\t\tconst partsXml = sorted\n\t\t\t.map((part) => {\n\t\t\t\tconst etag = stripEtagQuotes(part.etag)\n\t\t\t\treturn `<Part><PartNumber>${part.part_number}</PartNumber><ETag>\"${etag}\"</ETag></Part>`\n\t\t\t})\n\t\t\t.join('')\n\t\tconst body = `<CompleteMultipartUpload>${partsXml}</CompleteMultipartUpload>`\n\t\tconst query = new URLSearchParams({ uploadId: input.upload_id })\n\t\tconst response = await this.#aws.bytes('POST', objectUrl(this.#auth, wireKey, query.toString()), {\n\t\t\tlabel: 'S3 complete multipart upload',\n\t\t\tbody,\n\t\t\theaders: { 'Content-Type': 'application/xml' }\n\t\t})\n\t\tconst xml = bytesToUtf8(response.bytes)\n\t\tconst etagRaw = firstXmlText(xml, 'ETag')\n\t\tconst headerEtag = response.headers.get('etag')\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : isString(headerEtag) ? stripEtagQuotes(headerEtag) : undefined\n\t\tconst out: CompleteMultipartUploadOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: input.upload_id\n\t\t}\n\t\tif (etag) out.etag = etag\n\t\treturn out\n\t}\n\n\tasync abortMultipartUpload(input: AbortMultipartUploadInput): Promise<AbortMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst query = new URLSearchParams({ uploadId: input.upload_id })\n\t\tawait this.#aws.delete(objectUrl(this.#auth, wireKey, query.toString()), {\n\t\t\tlabel: 'S3 abort multipart upload',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\treturn { key: this.#publicKey(wireKey), upload_id: input.upload_id, aborted: true }\n\t}\n\n\t/** Host-facing raw download. Pass `maxBytes` to enforce a hard download cap. Logical key when key_prefix is set. */\n\tasync getBytes(key: string, options: { maxBytes?: number } = {}): Promise<Uint8Array> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst maxBytes = options.maxBytes\n\t\tif (maxBytes !== undefined) {\n\t\t\tconst { bytes } = await this.#getBoundedWire(wireKey, maxBytes, 'Object exceeds download limit')\n\t\t\treturn bytes\n\t\t}\n\t\ttry {\n\t\t\tconst { bytes } = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), { label: 'S3 get' })\n\t\t\treturn bytes\n\t\t} catch (error) {\n\t\t\tremapNotFound(error)\n\t\t}\n\t}\n\n\tasync getBytesRange(key: string, range: S3ByteRange): Promise<S3ByteRangeResult> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst requestedBytes = range.end_byte - range.start_byte + 1\n\t\tif (\n\t\t\t!Number.isSafeInteger(range.start_byte) ||\n\t\t\t!Number.isSafeInteger(range.end_byte) ||\n\t\t\trange.start_byte < 0 ||\n\t\t\trequestedBytes < 1\n\t\t) {\n\t\t\tthrow new ToolError('Byte range must use non-negative inclusive offsets with end_byte >= start_byte', {\n\t\t\t\tcode: 'bad_input'\n\t\t\t})\n\t\t}\n\t\tif (requestedBytes > MAX_OBJECT_BYTES) {\n\t\t\ttooLarge(MAX_OBJECT_BYTES, requestedBytes, 'Byte range exceeds download limit')\n\t\t}\n\n\t\tconst head = await this.#headWire(wireKey)\n\t\tif (!head.exists) objectNotFound()\n\t\tif (head.content_length !== undefined && range.start_byte >= head.content_length) {\n\t\t\tthrow new ToolError('Byte range starts beyond the end of the object', {\n\t\t\t\tcode: 'bad_input',\n\t\t\t\tdetails: { start_byte: range.start_byte, content_length: head.content_length }\n\t\t\t})\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\tRange: `bytes=${range.start_byte}-${range.end_byte}`\n\t\t}\n\t\tif (head.etag) headers['If-Match'] = head.etag.startsWith('\"') ? head.etag : `\"${head.etag}\"`\n\n\t\tlet response\n\t\ttry {\n\t\t\tresponse = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), {\n\t\t\t\tlabel: 'S3 range get',\n\t\t\t\theaders,\n\t\t\t\tmaxBytes: requestedBytes\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tif (isToolError(error) && error.details?.['status'] === 412) {\n\t\t\t\tthrow new ToolError('Object changed during download', {\n\t\t\t\t\tcode: 'upstream',\n\t\t\t\t\tdetails: { status: 412, key: this.#publicKey(wireKey) },\n\t\t\t\t\tcause: error\n\t\t\t\t})\n\t\t\t}\n\t\t\tremapNotFound(error)\n\t\t}\n\n\t\tconst out: S3ByteRangeResult = {\n\t\t\tbytes: response.bytes,\n\t\t\tstart_byte: range.start_byte,\n\t\t\tend_byte: range.start_byte + response.bytes.byteLength - 1\n\t\t}\n\t\tconst totalBytes = contentRangeTotal(response.headers.get('content-range')) ?? head.content_length\n\t\tconst contentType = response.headers.get('content-type') ?? head.content_type\n\t\tif (totalBytes !== undefined) out.total_bytes = totalBytes\n\t\tif (contentType) out.content_type = contentType\n\t\treturn out\n\t}\n\n\t/** Host-facing raw upload. Logical key when key_prefix is set. */\n\tasync putBytes(key: string, bytes: Uint8Array, contentType?: string): Promise<void> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst headers: Record<string, string> = {}\n\t\tif (isString(contentType) && contentType.length > 0) headers['Content-Type'] = contentType\n\t\tawait this.#aws.put(objectUrl(this.#auth, wireKey), toArrayBuffer(bytes), {\n\t\t\tlabel: 'S3 put',\n\t\t\theaders\n\t\t})\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { S3Client } from './client'\nimport {\n\tabortMultipartUploadInputSchema,\n\tabortMultipartUploadOutputSchema,\n\tcompleteMultipartUploadInputSchema,\n\tcompleteMultipartUploadOutputSchema,\n\tcopyObjectInputSchema,\n\tcopyObjectOutputSchema,\n\tcreateMultipartUploadInputSchema,\n\tcreateMultipartUploadOutputSchema,\n\tdeleteObjectInputSchema,\n\tdeleteObjectOutputSchema,\n\tgetObjectInputSchema,\n\tgetObjectOutputSchema,\n\theadObjectInputSchema,\n\theadObjectOutputSchema,\n\tlistObjectsInputSchema,\n\tlistObjectsOutputSchema,\n\tputObjectInputSchema,\n\tputObjectOutputSchema,\n\ts3AuthSchema,\n\tsignedUrlInputSchema,\n\tsignedUrlOutputSchema,\n\tuploadPartInputSchema,\n\tuploadPartOutputSchema\n} from './contracts'\n\nexport const s3ListObjectsTool = defineTool({\n\tid: 's3-list-objects',\n\tname: 's3ListObjects',\n\tdescription:\n\t\t'List objects in the bound S3 bucket. Use prefix, delimiter, cursor, and limit for filtered pagination. Returns keys, items with metadata, next_cursor, and truncated.',\n\tinputSchema: listObjectsInputSchema,\n\toutputSchema: listObjectsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).list(input)\n})\n\nexport const s3GetObjectTool = defineTool({\n\tid: 's3-get-object',\n\tname: 's3GetObject',\n\tdescription:\n\t\t'Download one object by key from S3. Bodies larger than 5 MiB fail. Returns body as base64 by default or utf8 when requested.',\n\tinputSchema: getObjectInputSchema,\n\toutputSchema: getObjectOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).get(input)\n})\n\nexport const s3PutObjectTool = defineTool({\n\tid: 's3-put-object',\n\tname: 's3PutObject',\n\tdescription:\n\t\t'Upload or replace one object by key in S3. Provide utf8 text or base64 body. Bodies larger than 5 MiB fail.',\n\tinputSchema: putObjectInputSchema,\n\toutputSchema: putObjectOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).put(input)\n})\n\nexport const s3DeleteObjectTool = defineTool({\n\tid: 's3-delete-object',\n\tname: 's3DeleteObject',\n\tdescription: 'Delete one object by key in S3. Idempotent for missing keys (404 treated as success).',\n\tinputSchema: deleteObjectInputSchema,\n\toutputSchema: deleteObjectOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).delete(input)\n})\n\nexport const s3HeadObjectTool = defineTool({\n\tid: 's3-head-object',\n\tname: 's3HeadObject',\n\tdescription:\n\t\t'Inspect S3 object metadata by key without downloading the body. Returns exists flag plus content type, length, and ETag when present.',\n\tinputSchema: headObjectInputSchema,\n\toutputSchema: headObjectOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).head(input)\n})\n\nexport const s3CopyObjectTool = defineTool({\n\tid: 's3-copy-object',\n\tname: 's3CopyObject',\n\tdescription:\n\t\t'Copy one S3 object to a new key. Set source_bucket only for an allowed cross-bucket copy; otherwise the configured bucket is used.',\n\tinputSchema: copyObjectInputSchema,\n\toutputSchema: copyObjectOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).copy(input)\n})\n\nexport const s3CreateSignedUrlTool = defineTool({\n\tid: 's3-create-signed-url',\n\tname: 's3CreateSignedUrl',\n\tdescription: 'Create a time-limited presigned S3 URL for one object key. Defaults to GET for 3600 seconds.',\n\tinputSchema: signedUrlInputSchema,\n\toutputSchema: signedUrlOutputSchema,\n\tsideEffect: 'none',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).createSignedUrl(input)\n})\n\nexport const s3CreateMultipartUploadTool = defineTool({\n\tid: 's3-create-multipart-upload',\n\tname: 's3CreateMultipartUpload',\n\tdescription:\n\t\t'Start an S3 multipart upload for one object key. Returns upload_id for uploadPart/complete/abort. Use for objects larger than the single put limit.',\n\tinputSchema: createMultipartUploadInputSchema,\n\toutputSchema: createMultipartUploadOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).createMultipartUpload(input)\n})\n\nexport const s3UploadPartTool = defineTool({\n\tid: 's3-upload-part',\n\tname: 's3UploadPart',\n\tdescription:\n\t\t'Upload one part of an in-progress S3 multipart upload. Part bodies up to 25 MiB. S3 requires each part except the last to be at least 5 MiB. Returns etag required for completeMultipartUpload.',\n\tinputSchema: uploadPartInputSchema,\n\toutputSchema: uploadPartOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).uploadPart(input)\n})\n\nexport const s3CompleteMultipartUploadTool = defineTool({\n\tid: 's3-complete-multipart-upload',\n\tname: 's3CompleteMultipartUpload',\n\tdescription:\n\t\t'Finish an S3 multipart upload by assembling uploaded parts (part_number + etag). Parts may be supplied in any order; they are sorted by part_number before complete.',\n\tinputSchema: completeMultipartUploadInputSchema,\n\toutputSchema: completeMultipartUploadOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).completeMultipartUpload(input)\n})\n\nexport const s3AbortMultipartUploadTool = defineTool({\n\tid: 's3-abort-multipart-upload',\n\tname: 's3AbortMultipartUpload',\n\tdescription: 'Abort an in-progress S3 multipart upload and discard uploaded parts for that upload_id.',\n\tinputSchema: abortMultipartUploadInputSchema,\n\toutputSchema: abortMultipartUploadOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).abortMultipartUpload(input)\n})\n\nexport const s3Module = defineModule({\n\tid: 's3',\n\ttitle: 'S3 / S3-compatible',\n\tdescription:\n\t\t'Store and retrieve objects with S3-compatible storage. Use for object listing, reads, writes, metadata, copies, deletion, signed URLs, and multipart uploads.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: s3AuthSchema },\n\tcategories: ['storage', 'aws'],\n\tclassification: 'pii',\n\ttags: ['object-store'],\n\ttools: [\n\t\ts3ListObjectsTool,\n\t\ts3GetObjectTool,\n\t\ts3PutObjectTool,\n\t\ts3DeleteObjectTool,\n\t\ts3HeadObjectTool,\n\t\ts3CopyObjectTool,\n\t\ts3CreateSignedUrlTool,\n\t\ts3CreateMultipartUploadTool,\n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,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,sBAAsB,KAAK;AACrF,CAAC;AAED,MAAa,mBAAmB,WAAW;CAC1C,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,WAAW,KAAK;AAC1E,CAAC;AAED,MAAa,gCAAgC,WAAW;CACvD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,wBAAwB,KAAK;AACvF,CAAC;AAED,MAAa,6BAA6B,WAAW;CACpD,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,qBAAqB,KAAK;AACpF,CAAC;AAED,MAAa,WAAW,aAAa;CACpC,IAAI;CACJ,OAAO;CACP,aACC;CACD,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAa;CAC7C,YAAY,CAAC,WAAW,KAAK;CAC7B,gBAAgB;CAChB,MAAM,CAAC,cAAc;CACrB,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"s3-TKCIZZ2q.js","names":["#auth","#aws","#keyPrefix","#resolve","#getBoundedWire","#headWire","#publicKey","#resolveCopySourceKey"],"sources":["../src/vendors/_storage/keys.ts","../src/vendors/_storage/schemas.ts","../src/vendors/s3/contracts.ts","../src/vendors/s3/domain.ts","../src/vendors/s3/client.ts","../src/vendors/s3/module.ts"],"sourcesContent":["/**\n * Object-key prefix helpers for storage vendors (S3, Textract DocumentLocation, …).\n * Logical keys are prefix-relative; wire keys include key_prefix when set.\n */\n\nimport { isToolError, ToolError } from '../../core/errors'\n\n/** S3 object key maximum length (bytes, UTF-8). */\nexport const MAX_OBJECT_KEY_BYTES = 1024\n\nfunction utf8ByteLength(value: string): number {\n\treturn new TextEncoder().encode(value).byteLength\n}\n\nfunction assertKeyByteLimit(wireKey: string): void {\n\tconst bytes = utf8ByteLength(wireKey)\n\tif (bytes > MAX_OBJECT_KEY_BYTES) {\n\t\tthrow new ToolError(`Object key exceeds ${MAX_OBJECT_KEY_BYTES} bytes`, {\n\t\t\tcode: 'bad_input',\n\t\t\tdetails: { max_bytes: MAX_OBJECT_KEY_BYTES, key_bytes: bytes }\n\t\t})\n\t}\n}\n\n/**\n * Split a logical path into segments. Rejects parent segments and leading absolute form.\n * Allows names like `report..final.pdf` (only a segment equal to `..` is rejected).\n */\nfunction keySegments(\n\tvalue: string,\n\toptions: { allowEmpty?: boolean; allowTrailingSlash?: boolean } = {}\n): { segments: string[]; trailingSlash: boolean } {\n\tconst trimmed = value.trim().replaceAll('\\\\', '/')\n\tif (trimmed.startsWith('/')) {\n\t\tthrow new ToolError('Object key must not be absolute (no leading /)', { code: 'bad_input' })\n\t}\n\tconst trailingSlash = trimmed.endsWith('/')\n\tif (trailingSlash && options.allowTrailingSlash !== true) {\n\t\tthrow new ToolError('Object key must not end with /', { code: 'bad_input' })\n\t}\n\tconst segments = trimmed.split('/').filter((segment) => segment.length > 0 && segment !== '.')\n\tfor (const segment of segments) {\n\t\tif (segment === '..') {\n\t\t\tthrow new ToolError('Object key must not contain parent-directory segments', { code: 'bad_input' })\n\t\t}\n\t}\n\tif (segments.length === 0 && !options.allowEmpty && !trailingSlash) {\n\t\tthrow new ToolError('Object key is required', { code: 'bad_input' })\n\t}\n\treturn { segments, trailingSlash }\n}\n\nfunction joinSegments(segments: string[], trailingSlash: boolean): string {\n\tconst joined = segments.join('/')\n\tif (trailingSlash) return joined.length > 0 ? `${joined}/` : ''\n\treturn joined\n}\n\nfunction remapAuthError(error: unknown): never {\n\tif (isToolError(error) && error.code === 'bad_input') {\n\t\tthrow new ToolError(error.message.replace(/^Object key/, 'key_prefix'), {\n\t\t\tcode: 'bad_auth',\n\t\t\t...(error.details !== undefined && { details: error.details }),\n\t\t\tcause: error\n\t\t})\n\t}\n\tthrow error\n}\n\n/** Normalize key_prefix from auth: non-absolute, no `..` segments, always ends with `/`. */\nexport function normalizeKeyPrefix(keyPrefix: string): string {\n\ttry {\n\t\tconst { segments } = keySegments(keyPrefix, { allowEmpty: false, allowTrailingSlash: true })\n\t\tif (segments.length === 0) {\n\t\t\tthrow new ToolError('key_prefix must not be empty', { code: 'bad_auth' })\n\t\t}\n\t\tconst root = `${segments.join('/')}/`\n\t\tassertKeyByteLimit(root)\n\t\treturn root\n\t} catch (error) {\n\t\tremapAuthError(error)\n\t}\n}\n\n/**\n * Resolve a logical object key to a wire key.\n * - No prefix: validated logical key (normalized segments).\n * - With prefix: relative keys are rooted; keys already under the prefix are accepted as-is.\n */\nexport function resolveObjectKey(logicalKey: string, keyPrefix: string | undefined): string {\n\tconst { segments } = keySegments(logicalKey, { allowEmpty: false })\n\tconst logical = joinSegments(segments, false)\n\tif (!keyPrefix) {\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tconst wire = logical.startsWith(keyPrefix) ? logical : `${keyPrefix}${logical}`\n\tassertKeyByteLimit(wire)\n\treturn wire\n}\n\n/**\n * Resolve a list prefix filter under optional key_prefix.\n * Empty / omitted relative → bound prefix root (or undefined when unbound).\n */\nexport function resolveListPrefix(\n\trelativePrefix: string | undefined,\n\tkeyPrefix: string | undefined\n): string | undefined {\n\tif (relativePrefix === undefined || relativePrefix.trim().length === 0) {\n\t\treturn keyPrefix\n\t}\n\tconst { segments, trailingSlash } = keySegments(relativePrefix, {\n\t\tallowEmpty: true,\n\t\tallowTrailingSlash: true\n\t})\n\tconst logical = joinSegments(segments, trailingSlash)\n\tif (!keyPrefix) {\n\t\tif (logical.length === 0) return undefined\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tif (logical.length === 0 || logical === keyPrefix.slice(0, -1) || logical === keyPrefix) {\n\t\treturn keyPrefix\n\t}\n\tif (logical.startsWith(keyPrefix)) {\n\t\tassertKeyByteLimit(logical)\n\t\treturn logical\n\t}\n\tconst wire = `${keyPrefix}${logical}`\n\tassertKeyByteLimit(wire)\n\treturn wire\n}\n\n/**\n * Map a wire key back to a logical (public) key.\n * Returns undefined when the wire key is outside key_prefix (caller should skip/filter).\n */\nexport function toPublicKey(wireKey: string, keyPrefix: string | undefined): string | undefined {\n\tif (!keyPrefix) return wireKey\n\tif (!wireKey.startsWith(keyPrefix)) return undefined\n\treturn wireKey.slice(keyPrefix.length)\n}\n","/**\n * Shared object-store I/O schemas for the s3 vendor pack (and nested S3 bindings).\n * Not published — `_storage` is skipped by codegen.\n */\n\nimport { z } from 'zod'\n\nimport { batchResultSchema } from '../../shared/batch'\n\nexport const MAX_OBJECT_BYTES = 5 * 1024 * 1024\nexport const DEFAULT_SIGNED_URL_SECONDS = 3600\nexport const MAX_SIGNED_URL_SECONDS = 7 * 24 * 3600\nexport const MAX_BATCH_ITEMS = 25\nexport const MAX_MULTIPART_PART_BYTES = 25 * 1024 * 1024\n\nexport const listedObjectSchema = z.object({\n\tkey: z.string(),\n\tsize: z.number().optional(),\n\tlast_modified: z.string().optional(),\n\tetag: z.string().optional()\n})\n\nexport const listObjectsInputSchema = z.object({\n\tprefix: z.string().optional().describe('Key prefix filter'),\n\tdelimiter: z.string().optional().describe('Delimiter for common prefixes (folders), for example /'),\n\tcursor: z.string().min(1).optional().describe('Pagination cursor from a prior list call'),\n\tlimit: z.int().min(1).max(1000).optional().describe('Maximum keys to return (1-1000)')\n})\n\nexport const listObjectsOutputSchema = z.object({\n\tkeys: z.array(z.string()).describe('Object keys (convenience list)'),\n\titems: z.array(listedObjectSchema).describe('Objects with size, last_modified, and etag when present'),\n\tcommon_prefixes: z.array(z.string()).optional().describe('Common prefixes when delimiter is set'),\n\tnext_cursor: z.string().optional().describe('Pass as cursor to fetch the next page'),\n\ttruncated: z.boolean().describe('Whether more results exist')\n})\n\nexport const getObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to download'),\n\tencoding: z.enum(['base64', 'utf8']).optional().describe('Body encoding. Defaults to base64 for binary safety')\n})\n\nexport const getObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tcontent_type: z.string().optional(),\n\tcontent_length: z.number().optional(),\n\tbody: z.string().describe('Object body encoded per encoding input'),\n\tencoding: z.enum(['base64', 'utf8'])\n})\n\nexport const putObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to write'),\n\tbody: z.string().describe('Object body as utf8 text or base64 (see body_encoding)'),\n\tbody_encoding: z.enum(['utf8', 'base64']).optional().describe('How to interpret body. Defaults to utf8'),\n\tcontent_type: z.string().optional().describe('Content-Type header to store')\n})\n\nexport const putObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tetag: z.string().optional(),\n\tcontent_length: z.number().describe('Decoded body byte length uploaded')\n})\n\nexport const deleteObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to delete')\n})\n\nexport const deleteObjectOutputSchema = z.object({\n\tkey: z.string(),\n\tdeleted: z.boolean()\n})\n\nexport const headObjectInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to inspect')\n})\n\nexport const headObjectOutputSchema = z.object({\n\tkey: z.string(),\n\texists: z.boolean(),\n\tcontent_type: z.string().optional(),\n\tcontent_length: z.number().optional(),\n\tetag: z.string().optional()\n})\n\nexport const copyObjectInputSchema = z.object({\n\tsource_key: z.string().min(1).describe('Source object key to copy from'),\n\tdestination_key: z.string().min(1).describe('Destination object key to copy to'),\n\tsource_bucket: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe('Optional source bucket when different from the configured default bucket')\n})\n\nexport const copyObjectOutputSchema = z.object({\n\tsource_key: z.string(),\n\tdestination_key: z.string(),\n\tetag: z.string().optional()\n})\n\nexport const signedUrlInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to sign'),\n\tmethod: z\n\t\t.enum(['GET', 'PUT', 'HEAD', 'DELETE'])\n\t\t.optional()\n\t\t.describe('HTTP method the URL authorizes. Defaults to GET'),\n\texpires_in: z\n\t\t.int()\n\t\t.min(1)\n\t\t.max(MAX_SIGNED_URL_SECONDS)\n\t\t.optional()\n\t\t.describe('URL lifetime in seconds (1 to 604800). Defaults to 3600')\n})\n\nexport const signedUrlOutputSchema = z.object({\n\turl: z.url().describe('Presigned URL'),\n\tmethod: z.enum(['GET', 'PUT', 'HEAD', 'DELETE']),\n\texpires_in: z.int().describe('Lifetime in seconds used when signing')\n})\n\nexport const createMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key to create via multipart upload'),\n\tcontent_type: z.string().optional().describe('Content-Type stored on the completed object')\n})\n\nexport const createMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string().min(1).describe('Upload id required for subsequent part/complete/abort calls')\n})\n\nexport const uploadPartInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload'),\n\tpart_number: z.int().min(1).max(10_000).describe('Part number (1-10000). Must be unique within the upload'),\n\tbody: z.string().describe('Part body as utf8 text or base64 (see body_encoding)'),\n\tbody_encoding: z.enum(['utf8', 'base64']).optional().describe('How to interpret body. Defaults to utf8')\n})\n\nexport const uploadPartOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\tpart_number: z.int(),\n\tetag: z.string().min(1).describe('Part ETag required when completing the multipart upload'),\n\tcontent_length: z.number().describe('Decoded part byte length uploaded')\n})\n\nexport const multipartUploadedPartSchema = z.object({\n\tpart_number: z.int().min(1).max(10_000).describe('Uploaded part number from s3-upload-part'),\n\tetag: z.string().min(1).describe('ETag returned by uploadPart (with or without surrounding quotes)')\n})\n\nexport const completeMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload'),\n\tparts: z\n\t\t.array(multipartUploadedPartSchema)\n\t\t.min(1)\n\t\t.max(10_000)\n\t\t.describe('Uploaded parts with part_number and etag, in any order (sorted before complete)')\n})\n\nexport const completeMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\tetag: z.string().optional().describe('Final object ETag when the store returns one')\n})\n\nexport const abortMultipartUploadInputSchema = z.object({\n\tkey: z.string().min(1).describe('Object key for the in-progress multipart upload'),\n\tupload_id: z.string().min(1).describe('Upload id from createMultipartUpload')\n})\n\nexport const abortMultipartUploadOutputSchema = z.object({\n\tkey: z.string(),\n\tupload_id: z.string(),\n\taborted: z.boolean()\n})\n\nexport const getObjectsInputSchema = z.object({\n\tkeys: z.array(z.string().min(1)).min(1).max(MAX_BATCH_ITEMS).describe('Object keys to download'),\n\tencoding: z.enum(['base64', 'utf8']).optional().describe('Body encoding for each item. Defaults to base64')\n})\n\nexport const putObjectsInputSchema = z.object({\n\tobjects: z.array(putObjectInputSchema).min(1).max(MAX_BATCH_ITEMS).describe('Objects to upload')\n})\n\nexport const deleteObjectsInputSchema = z.object({\n\tkeys: z.array(z.string().min(1)).min(1).max(MAX_BATCH_ITEMS).describe('Object keys to delete')\n})\n\nexport const getObjectsOutputSchema = batchResultSchema(getObjectOutputSchema)\nexport const putObjectsOutputSchema = batchResultSchema(putObjectOutputSchema)\nexport const deleteObjectsOutputSchema = batchResultSchema(deleteObjectOutputSchema)\n\nexport type ListObjectsInput = z.infer<typeof listObjectsInputSchema>\nexport type ListObjectsOutput = z.infer<typeof listObjectsOutputSchema>\nexport type GetObjectInput = z.infer<typeof getObjectInputSchema>\nexport type GetObjectOutput = z.infer<typeof getObjectOutputSchema>\nexport type PutObjectInput = z.infer<typeof putObjectInputSchema>\nexport type PutObjectOutput = z.infer<typeof putObjectOutputSchema>\nexport type DeleteObjectInput = z.infer<typeof deleteObjectInputSchema>\nexport type DeleteObjectOutput = z.infer<typeof deleteObjectOutputSchema>\nexport type HeadObjectInput = z.infer<typeof headObjectInputSchema>\nexport type HeadObjectOutput = z.infer<typeof headObjectOutputSchema>\nexport type CopyObjectInput = z.infer<typeof copyObjectInputSchema>\nexport type CopyObjectOutput = z.infer<typeof copyObjectOutputSchema>\nexport type SignedUrlInput = z.infer<typeof signedUrlInputSchema>\nexport type SignedUrlOutput = z.infer<typeof signedUrlOutputSchema>\nexport type CreateMultipartUploadInput = z.infer<typeof createMultipartUploadInputSchema>\nexport type CreateMultipartUploadOutput = z.infer<typeof createMultipartUploadOutputSchema>\nexport type UploadPartInput = z.infer<typeof uploadPartInputSchema>\nexport type UploadPartOutput = z.infer<typeof uploadPartOutputSchema>\nexport type CompleteMultipartUploadInput = z.infer<typeof completeMultipartUploadInputSchema>\nexport type CompleteMultipartUploadOutput = z.infer<typeof completeMultipartUploadOutputSchema>\nexport type AbortMultipartUploadInput = z.infer<typeof abortMultipartUploadInputSchema>\nexport type AbortMultipartUploadOutput = z.infer<typeof abortMultipartUploadOutputSchema>\n","/**\n * S3 / S3-compatible vendor auth + re-exports of shared object-store I/O.\n */\n\nimport { z } from 'zod'\n\nexport {\n\tabortMultipartUploadInputSchema,\n\tabortMultipartUploadOutputSchema,\n\tcompleteMultipartUploadInputSchema,\n\tcompleteMultipartUploadOutputSchema,\n\tcopyObjectInputSchema,\n\tcopyObjectOutputSchema,\n\tcreateMultipartUploadInputSchema,\n\tcreateMultipartUploadOutputSchema,\n\tDEFAULT_SIGNED_URL_SECONDS,\n\tdeleteObjectInputSchema,\n\tdeleteObjectOutputSchema,\n\tgetObjectInputSchema,\n\tgetObjectOutputSchema,\n\theadObjectInputSchema,\n\theadObjectOutputSchema,\n\tlistObjectsInputSchema,\n\tlistObjectsOutputSchema,\n\tlistedObjectSchema,\n\tMAX_MULTIPART_PART_BYTES,\n\tMAX_OBJECT_BYTES,\n\tMAX_SIGNED_URL_SECONDS,\n\tmultipartUploadedPartSchema,\n\tputObjectInputSchema,\n\tputObjectOutputSchema,\n\tsignedUrlInputSchema,\n\tsignedUrlOutputSchema,\n\tuploadPartInputSchema,\n\tuploadPartOutputSchema\n} from '../_storage'\nexport type {\n\tAbortMultipartUploadInput,\n\tAbortMultipartUploadOutput,\n\tCompleteMultipartUploadInput,\n\tCompleteMultipartUploadOutput,\n\tCopyObjectInput,\n\tCopyObjectOutput,\n\tCreateMultipartUploadInput,\n\tCreateMultipartUploadOutput,\n\tDeleteObjectInput,\n\tDeleteObjectOutput,\n\tGetObjectInput,\n\tGetObjectOutput,\n\tHeadObjectInput,\n\tHeadObjectOutput,\n\tListObjectsInput,\n\tListObjectsOutput,\n\tPutObjectInput,\n\tPutObjectOutput,\n\tSignedUrlInput,\n\tSignedUrlOutput,\n\tUploadPartInput,\n\tUploadPartOutput\n} from '../_storage'\n\nexport const s3AuthSchema = z.object({\n\taccess_key_id: z.string().min(1).describe('S3 access key id'),\n\tsecret_access_key: z.string().min(1).describe('S3 secret access key'),\n\tregion: z.string().min(1).describe('AWS region, or auto / us-east-1 for R2 S3 endpoint'),\n\tbucket: z.string().min(1).describe('Default bucket name'),\n\tendpoint: z\n\t\t.url()\n\t\t.optional()\n\t\t.describe('S3-compatible endpoint when not AWS (R2: https://<account_id>.r2.cloudflarestorage.com, MinIO, …)'),\n\tsession_token: z.string().min(1).optional().describe('Optional session token for temporary credentials'),\n\tkey_prefix: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Optional object-key root for this binding (no leading slash). Logical keys are relative to this prefix; wire keys include it. Host tenant scoping binds once here.'\n\t\t)\n})\n\nexport type S3Auth = z.infer<typeof s3AuthSchema>\n","/**\n * S3 URL building + XML response parse (fast-xml-parser).\n */\n\nimport { isPlainObject, isString } from 'es-toolkit'\nimport { isArray } from 'es-toolkit/compat'\nimport { XMLParser } from 'fast-xml-parser'\n\nimport { encodeObjectKeyPath } from '../../shared/bytes'\nimport type { S3Auth } from './contracts'\n\nexport type ListedObject = {\n\tkey: string\n\tsize?: number\n\tlast_modified?: string\n\tetag?: string\n}\n\nexport type ParsedListResult = {\n\titems: ListedObject[]\n\ttruncated: boolean\n\tnext_cursor?: string\n\tcommon_prefixes?: string[]\n}\n\nconst listParser = new XMLParser({\n\tignoreAttributes: true,\n\ttrimValues: true,\n\t// Always arrays so single Contents/CommonPrefixes match multi-item shape\n\tisArray: (name) => name === 'Contents' || name === 'CommonPrefixes'\n})\n\nconst genericParser = new XMLParser({\n\tignoreAttributes: true,\n\ttrimValues: true\n})\n\nexport function objectUrl(auth: S3Auth, key: string, query?: string): string {\n\tconst encodedKey = encodeObjectKeyPath(key)\n\tconst base = auth.endpoint\n\t\t? `${auth.endpoint.replace(/\\/+$/, '')}/${encodeURIComponent(auth.bucket)}/${encodedKey}`\n\t\t: `https://${auth.bucket}.s3.${auth.region}.amazonaws.com/${encodedKey}`\n\treturn query ? `${base}?${query}` : base\n}\n\nexport function listUrl(auth: S3Auth, params: URLSearchParams): string {\n\tconst base = auth.endpoint\n\t\t? `${auth.endpoint.replace(/\\/+$/, '')}/${encodeURIComponent(auth.bucket)}`\n\t\t: `https://${auth.bucket}.s3.${auth.region}.amazonaws.com`\n\tconst qs = params.toString()\n\treturn qs ? `${base}?${qs}` : base\n}\n\nexport function copySourceHeader(auth: S3Auth, sourceKey: string, sourceBucket?: string): string {\n\tconst bucket = sourceBucket ?? auth.bucket\n\treturn `/${encodeURIComponent(bucket)}/${encodeObjectKeyPath(sourceKey)}`\n}\n\nexport function stripEtagQuotes(etag: string): string {\n\treturn etag.replaceAll('\"', '')\n}\n\n/** Parse `Content-Range: bytes start-end/total` → total object size when known. */\nexport function contentRangeTotal(header: string | null): number | undefined {\n\tif (header === null || header.length === 0) return undefined\n\tconst slash = header.lastIndexOf('/')\n\tif (slash < 0) return undefined\n\tconst totalRaw = header.slice(slash + 1).trim()\n\tif (totalRaw === '*' || totalRaw.length === 0) return undefined\n\tconst total = Number.parseInt(totalRaw, 10)\n\treturn Number.isFinite(total) ? total : undefined\n}\n\nfunction asArray(value: unknown): unknown[] {\n\tif (value === undefined || value === null) return []\n\treturn isArray(value) ? value : [value]\n}\n\nfunction textValue(value: unknown): string | undefined {\n\tif (isString(value) && value.length > 0) return value\n\tif (typeof value === 'number' && Number.isFinite(value)) return String(value)\n\tif (typeof value === 'boolean') return value ? 'true' : 'false'\n\treturn undefined\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\tif (typeof value === 'number' && Number.isFinite(value)) return value\n\tif (isString(value) && value.length > 0) {\n\t\tconst n = Number.parseInt(value, 10)\n\t\treturn Number.isFinite(n) ? n : undefined\n\t}\n\treturn undefined\n}\n\n/** Parse ListObjectsV2 XML into list items + pagination. */\nexport function parseListResult(xml: string): ParsedListResult {\n\tconst doc: unknown = listParser.parse(xml)\n\tconst root =\n\t\tisPlainObject(doc) && isPlainObject(doc['ListBucketResult'])\n\t\t\t? doc['ListBucketResult']\n\t\t\t: isPlainObject(doc)\n\t\t\t\t? doc\n\t\t\t\t: null\n\tif (!root) {\n\t\treturn { items: [], truncated: false }\n\t}\n\n\tconst items: ListedObject[] = []\n\tfor (const row of asArray(root['Contents'])) {\n\t\tif (!isPlainObject(row)) continue\n\t\tconst key = textValue(row['Key'])\n\t\tif (!key) continue\n\t\tconst size = numberValue(row['Size'])\n\t\tconst last_modified = textValue(row['LastModified'])\n\t\tconst etagRaw = textValue(row['ETag'])\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : undefined\n\t\titems.push({\n\t\t\tkey,\n\t\t\t...(size !== undefined && { size }),\n\t\t\t...(last_modified && { last_modified }),\n\t\t\t...(etag && { etag })\n\t\t})\n\t}\n\n\tconst truncatedRaw = root['IsTruncated']\n\tconst truncated =\n\t\ttruncatedRaw === true ||\n\t\ttruncatedRaw === 'true' ||\n\t\t(isString(truncatedRaw) && truncatedRaw.toLowerCase() === 'true')\n\n\tconst next = textValue(root['NextContinuationToken'])\n\tconst common_prefixes: string[] = []\n\tfor (const row of asArray(root['CommonPrefixes'])) {\n\t\tif (!isPlainObject(row)) continue\n\t\tconst prefix = textValue(row['Prefix'])\n\t\tif (prefix) common_prefixes.push(prefix)\n\t}\n\n\treturn {\n\t\titems,\n\t\ttruncated,\n\t\t...(next && { next_cursor: next }),\n\t\t...(common_prefixes.length > 0 && { common_prefixes })\n\t}\n}\n\n/** First text value for a tag anywhere in a small S3 XML body (ETag, UploadId, …). */\nexport function firstXmlText(xml: string, tag: string): string | undefined {\n\tconst doc: unknown = genericParser.parse(xml)\n\treturn findTagText(doc, tag)\n}\n\nfunction findTagText(node: unknown, tag: string): string | undefined {\n\tif (!isPlainObject(node)) return undefined\n\tif (Object.hasOwn(node, tag)) {\n\t\tconst direct = textValue(node[tag])\n\t\tif (direct) return direct\n\t}\n\tfor (const value of Object.values(node)) {\n\t\tconst found = findTagText(value, tag)\n\t\tif (found) return found\n\t}\n\treturn undefined\n}\n","/**\n * S3 / S3-compatible object-store client (AwsService SigV4).\n * Host: `new S3Client(auth)`. Agent tools: `fromContext(ctx)`.\n *\n * When auth.key_prefix is set, public API keys are logical (prefix-relative);\n * wire keys always include the prefix. Resolve once; private methods take wire keys.\n */\n\nimport { isNil, isNumber, isString } from 'es-toolkit'\n\nimport { isToolError, ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { base64ToBytes, bytesToBase64, bytesToUtf8, toArrayBuffer, utf8ToBytes } from '../../shared/bytes'\nimport { AwsService } from '../../transport/aws-service'\nimport type { AwsServiceOptions } from '../../transport/aws-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport { normalizeKeyPrefix, resolveListPrefix, resolveObjectKey, toPublicKey } from '../_storage'\nimport type {\n\tAbortMultipartUploadInput,\n\tAbortMultipartUploadOutput,\n\tCompleteMultipartUploadInput,\n\tCompleteMultipartUploadOutput,\n\tCopyObjectInput,\n\tCopyObjectOutput,\n\tCreateMultipartUploadInput,\n\tCreateMultipartUploadOutput,\n\tDeleteObjectInput,\n\tDeleteObjectOutput,\n\tGetObjectInput,\n\tGetObjectOutput,\n\tHeadObjectInput,\n\tHeadObjectOutput,\n\tListObjectsInput,\n\tListObjectsOutput,\n\tPutObjectInput,\n\tPutObjectOutput,\n\tS3Auth,\n\tSignedUrlInput,\n\tSignedUrlOutput,\n\tUploadPartInput,\n\tUploadPartOutput\n} from './contracts'\nimport { DEFAULT_SIGNED_URL_SECONDS, MAX_MULTIPART_PART_BYTES, MAX_OBJECT_BYTES, s3AuthSchema } from './contracts'\nimport {\n\tcontentRangeTotal,\n\tcopySourceHeader,\n\tfirstXmlText,\n\tlistUrl,\n\tobjectUrl,\n\tparseListResult,\n\tstripEtagQuotes\n} from './domain'\n\nexport type S3ClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport type S3ByteRange = {\n\tstart_byte: number\n\tend_byte: number\n}\n\nexport type S3ByteRangeResult = {\n\tbytes: Uint8Array\n\tstart_byte: number\n\tend_byte: number\n\ttotal_bytes?: number | undefined\n\tcontent_type?: string | undefined\n}\n\nfunction objectNotFound(): never {\n\tthrow new ToolError('Object not found', { code: 'not_found' })\n}\n\nfunction remapNotFound(error: unknown): never {\n\tif (isToolError(error) && error.code === 'not_found') objectNotFound()\n\tthrow error\n}\n\nfunction tooLarge(maxBytes: number, contentLength: number, message: string, cause?: unknown): never {\n\tthrow new ToolError(message, {\n\t\tcode: 'too_large',\n\t\tdetails: { max_bytes: maxBytes, content_length: contentLength },\n\t\t...(cause !== undefined && { cause })\n\t})\n}\n\nfunction assertByteLimit(maxBytes: number): void {\n\tif (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {\n\t\tthrow new ToolError('Download limit must be a non-negative safe integer', { code: 'bad_input' })\n\t}\n}\n\nexport class S3Client {\n\treadonly #auth: S3Auth\n\treadonly #aws: AwsService\n\t/** Normalized key_prefix with trailing `/`, or undefined when unbound. */\n\treadonly #keyPrefix: string | undefined\n\n\tconstructor(auth: S3Auth, options: S3ClientOptions = {}) {\n\t\tconst parsed = s3AuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid S3 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.#auth = parsed.data\n\t\tthis.#keyPrefix = parsed.data.key_prefix !== undefined ? normalizeKeyPrefix(parsed.data.key_prefix) : undefined\n\n\t\tconst awsOptions: AwsServiceOptions = {\n\t\t\taccessKeyId: this.#auth.access_key_id,\n\t\t\tsecretAccessKey: this.#auth.secret_access_key,\n\t\t\tregion: this.#auth.region,\n\t\t\tservice: 's3',\n\t\t\tlabel: 'S3'\n\t\t}\n\t\tif (options.fetch) awsOptions.fetch = options.fetch\n\t\tif (options.signal) awsOptions.signal = options.signal\n\t\tif (this.#auth.session_token) awsOptions.sessionToken = this.#auth.session_token\n\t\tthis.#aws = new AwsService(awsOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): S3Client {\n\t\tconst auth = requireAuth(ctx, s3AuthSchema)\n\t\tconst options: S3ClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new S3Client(auth, options)\n\t}\n\n\t#resolve(logicalKey: string): string {\n\t\treturn resolveObjectKey(logicalKey, this.#keyPrefix)\n\t}\n\n\t#publicKey(wireKey: string): string {\n\t\tconst publicKey = toPublicKey(wireKey, this.#keyPrefix)\n\t\tif (publicKey === undefined) {\n\t\t\tthrow new ToolError('Object key is outside the bound key_prefix', { code: 'bad_input' })\n\t\t}\n\t\treturn publicKey\n\t}\n\n\t/** Source key for copy: scoped only when same bucket as this client. */\n\t#resolveCopySourceKey(sourceKey: string, sourceBucket: string | undefined): string {\n\t\tconst sameBucket = sourceBucket === undefined || sourceBucket === this.#auth.bucket\n\t\tif (sameBucket) return this.#resolve(sourceKey)\n\t\t// Foreign bucket: validate shape only; do not apply this binding's key_prefix.\n\t\treturn resolveObjectKey(sourceKey, undefined)\n\t}\n\n\tasync list(input: ListObjectsInput): Promise<ListObjectsOutput> {\n\t\tconst prefix = resolveListPrefix(input.prefix, this.#keyPrefix)\n\t\tconst params = new URLSearchParams({ 'list-type': '2' })\n\t\tif (prefix !== undefined) params.set('prefix', prefix)\n\t\tif (input.delimiter) params.set('delimiter', input.delimiter)\n\t\tif (input.cursor) params.set('continuation-token', input.cursor)\n\t\tif (input.limit !== undefined) params.set('max-keys', String(input.limit))\n\n\t\tconst { bytes } = await this.#aws.bytes('GET', listUrl(this.#auth, params), { label: 'S3 list' })\n\t\tconst listed = parseListResult(bytesToUtf8(bytes))\n\n\t\tconst items = []\n\t\tconst keys: string[] = []\n\t\tfor (const obj of listed.items) {\n\t\t\tconst publicKey = toPublicKey(obj.key, this.#keyPrefix)\n\t\t\tif (publicKey === undefined) continue\n\t\t\tkeys.push(publicKey)\n\t\t\titems.push({\n\t\t\t\tkey: publicKey,\n\t\t\t\t...(obj.size !== undefined && { size: obj.size }),\n\t\t\t\t...(obj.last_modified && { last_modified: obj.last_modified }),\n\t\t\t\t...(obj.etag && { etag: obj.etag })\n\t\t\t})\n\t\t}\n\n\t\tconst out: ListObjectsOutput = {\n\t\t\tkeys,\n\t\t\titems,\n\t\t\ttruncated: listed.truncated\n\t\t}\n\t\tif (listed.common_prefixes && listed.common_prefixes.length > 0) {\n\t\t\tconst common: string[] = []\n\t\t\tfor (const folderAbs of listed.common_prefixes) {\n\t\t\t\tconst publicPrefix = toPublicKey(folderAbs, this.#keyPrefix)\n\t\t\t\tif (publicPrefix !== undefined) common.push(publicPrefix)\n\t\t\t}\n\t\t\tif (common.length > 0) out.common_prefixes = common\n\t\t}\n\t\tif (listed.next_cursor) out.next_cursor = listed.next_cursor\n\t\treturn out\n\t}\n\n\t/** HEAD size gate plus a bounded Range GET (wire key only). */\n\tasync #getBoundedWire(\n\t\twireKey: string,\n\t\tmaxBytes: number,\n\t\tlimitMessage: string\n\t): Promise<{ bytes: Uint8Array; headers: Headers; head: HeadObjectOutput }> {\n\t\tassertByteLimit(maxBytes)\n\t\tconst head = await this.#headWire(wireKey)\n\t\tif (!head.exists) objectNotFound()\n\t\tif (!isNil(head.content_length) && head.content_length > maxBytes) {\n\t\t\ttooLarge(maxBytes, head.content_length, limitMessage)\n\t\t}\n\t\tif (head.content_length === 0) {\n\t\t\tconst headers = new Headers({ 'content-length': '0' })\n\t\t\tif (head.content_type) headers.set('content-type', head.content_type)\n\t\t\tif (head.etag) headers.set('etag', `\"${head.etag}\"`)\n\t\t\treturn { bytes: new Uint8Array(), headers, head }\n\t\t}\n\n\t\tconst headers: Record<string, string> = { Range: `bytes=0-${maxBytes}` }\n\t\tif (head.etag) headers['If-Match'] = head.etag.startsWith('\"') ? head.etag : `\"${head.etag}\"`\n\n\t\tlet response\n\t\ttry {\n\t\t\tresponse = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), {\n\t\t\t\tlabel: 'S3 get',\n\t\t\t\theaders,\n\t\t\t\tmaxBytes\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tif (isToolError(error) && error.code === 'too_large') {\n\t\t\t\tconst observed = error.details?.['content_length']\n\t\t\t\ttooLarge(\n\t\t\t\t\tmaxBytes,\n\t\t\t\t\tisNumber(observed) && Number.isFinite(observed) ? observed : maxBytes + 1,\n\t\t\t\t\tlimitMessage,\n\t\t\t\t\terror\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (isToolError(error) && error.details?.['status'] === 412) {\n\t\t\t\tthrow new ToolError('Object changed during download', {\n\t\t\t\t\tcode: 'upstream',\n\t\t\t\t\tdetails: { status: 412, key: this.#publicKey(wireKey) },\n\t\t\t\t\tcause: error\n\t\t\t\t})\n\t\t\t}\n\t\t\tremapNotFound(error)\n\t\t}\n\n\t\tconst total = contentRangeTotal(response.headers.get('content-range'))\n\t\tif (total !== undefined && total > maxBytes) tooLarge(maxBytes, total, limitMessage)\n\t\treturn { bytes: response.bytes, headers: response.headers, head }\n\t}\n\n\tasync #headWire(wireKey: string): Promise<HeadObjectOutput> {\n\t\tconst response = await this.#aws.head(objectUrl(this.#auth, wireKey), {\n\t\t\tlabel: 'S3 head',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\tconst publicKey = this.#publicKey(wireKey)\n\t\tif (response.status === 404) {\n\t\t\treturn { key: publicKey, exists: false }\n\t\t}\n\t\tconst contentType = response.headers.get('content-type')\n\t\tconst lengthHeader = response.headers.get('content-length')\n\t\tconst etag = response.headers.get('etag')\n\t\tconst contentLength = isString(lengthHeader) ? Number.parseInt(lengthHeader, 10) : undefined\n\t\tconst out: HeadObjectOutput = {\n\t\t\tkey: publicKey,\n\t\t\texists: true\n\t\t}\n\t\tif (isString(contentType)) out.content_type = contentType\n\t\tif (!isNil(contentLength) && Number.isFinite(contentLength)) out.content_length = contentLength\n\t\tif (isString(etag)) out.etag = stripEtagQuotes(etag)\n\t\treturn out\n\t}\n\n\tasync get(input: GetObjectInput): Promise<GetObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst {\n\t\t\tbytes: bodyBytes,\n\t\t\theaders: responseHeaders,\n\t\t\thead\n\t\t} = await this.#getBoundedWire(wireKey, MAX_OBJECT_BYTES, 'Object exceeds 5 MiB download limit')\n\t\tconst encoding = input.encoding ?? 'base64'\n\t\tconst body = encoding === 'utf8' ? bytesToUtf8(bodyBytes) : bytesToBase64(bodyBytes)\n\t\tconst contentType = responseHeaders.get('content-type') ?? head.content_type\n\t\tconst lengthHeader = responseHeaders.get('content-length')\n\t\tconst contentLength = isString(lengthHeader) ? Number.parseInt(lengthHeader, 10) : head.content_length\n\t\tconst out: GetObjectOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tbody,\n\t\t\tencoding\n\t\t}\n\t\tif (isString(contentType)) out.content_type = contentType\n\t\t// Prefer HEAD length (full object); Range responses report partial Content-Length.\n\t\tout.content_length =\n\t\t\t!isNil(head.content_length) && Number.isFinite(head.content_length)\n\t\t\t\t? head.content_length\n\t\t\t\t: isNil(contentLength) || !Number.isFinite(contentLength)\n\t\t\t\t\t? bodyBytes.byteLength\n\t\t\t\t\t: contentLength\n\t\treturn out\n\t}\n\n\tasync put(input: PutObjectInput): Promise<PutObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst encoding = input.body_encoding ?? 'utf8'\n\t\tconst bodyBytes = encoding === 'base64' ? base64ToBytes(input.body) : utf8ToBytes(input.body)\n\t\tif (bodyBytes.byteLength > MAX_OBJECT_BYTES) {\n\t\t\tthrow new ToolError('Object exceeds 5 MiB upload limit', {\n\t\t\t\tcode: 'too_large',\n\t\t\t\tdetails: { max_bytes: MAX_OBJECT_BYTES, content_length: bodyBytes.byteLength }\n\t\t\t})\n\t\t}\n\t\tconst headers: Record<string, string> = {}\n\t\tif (input.content_type) headers['Content-Type'] = input.content_type\n\n\t\tconst response = await this.#aws.put(objectUrl(this.#auth, wireKey), toArrayBuffer(bodyBytes), {\n\t\t\tlabel: 'S3 put',\n\t\t\theaders\n\t\t})\n\t\tconst etag = response.headers.get('etag')\n\t\tconst out: PutObjectOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tcontent_length: bodyBytes.byteLength\n\t\t}\n\t\tif (isString(etag)) out.etag = stripEtagQuotes(etag)\n\t\treturn out\n\t}\n\n\tasync delete(input: DeleteObjectInput): Promise<DeleteObjectOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tawait this.#aws.delete(objectUrl(this.#auth, wireKey), {\n\t\t\tlabel: 'S3 delete',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\treturn { key: this.#publicKey(wireKey), deleted: true }\n\t}\n\n\tasync head(input: HeadObjectInput): Promise<HeadObjectOutput> {\n\t\treturn this.#headWire(this.#resolve(input.key))\n\t}\n\n\tasync copy(input: CopyObjectInput): Promise<CopyObjectOutput> {\n\t\tconst destWire = this.#resolve(input.destination_key)\n\t\tconst sourceWire = this.#resolveCopySourceKey(input.source_key, input.source_bucket)\n\t\tconst response = await this.#aws.bytes('PUT', objectUrl(this.#auth, destWire), {\n\t\t\tlabel: 'S3 copy',\n\t\t\theaders: {\n\t\t\t\t'x-amz-copy-source': copySourceHeader(this.#auth, sourceWire, input.source_bucket)\n\t\t\t}\n\t\t})\n\t\tconst xml = bytesToUtf8(response.bytes)\n\t\tconst etagRaw = firstXmlText(xml, 'ETag')\n\t\tconst headerEtag = response.headers.get('etag')\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : isString(headerEtag) ? stripEtagQuotes(headerEtag) : undefined\n\t\tconst out: CopyObjectOutput = {\n\t\t\tsource_key:\n\t\t\t\tinput.source_bucket === undefined || input.source_bucket === this.#auth.bucket\n\t\t\t\t\t? this.#publicKey(sourceWire)\n\t\t\t\t\t: sourceWire,\n\t\t\tdestination_key: this.#publicKey(destWire)\n\t\t}\n\t\tif (etag) out.etag = etag\n\t\treturn out\n\t}\n\n\tasync createSignedUrl(input: SignedUrlInput): Promise<SignedUrlOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst method = input.method ?? 'GET'\n\t\tconst expiresIn = input.expires_in ?? DEFAULT_SIGNED_URL_SECONDS\n\t\tconst url = objectUrl(this.#auth, wireKey, `X-Amz-Expires=${expiresIn}`)\n\t\tconst signed = await this.#aws.sign(url, {\n\t\t\tmethod,\n\t\t\tsignQuery: true\n\t\t})\n\t\treturn {\n\t\t\turl: signed.url,\n\t\t\tmethod,\n\t\t\texpires_in: expiresIn\n\t\t}\n\t}\n\n\tasync createMultipartUpload(input: CreateMultipartUploadInput): Promise<CreateMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst headers: Record<string, string> = {}\n\t\tif (input.content_type) headers['Content-Type'] = input.content_type\n\t\tconst { bytes } = await this.#aws.bytes('POST', objectUrl(this.#auth, wireKey, 'uploads'), {\n\t\t\tlabel: 'S3 create multipart upload',\n\t\t\theaders\n\t\t})\n\t\tconst uploadIdRaw = firstXmlText(bytesToUtf8(bytes), 'UploadId')\n\t\tif (!uploadIdRaw) {\n\t\t\tthrow new ToolError('S3 create multipart upload returned no UploadId', { code: 'upstream' })\n\t\t}\n\t\treturn {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: uploadIdRaw\n\t\t}\n\t}\n\n\tasync uploadPart(input: UploadPartInput): Promise<UploadPartOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst encoding = input.body_encoding ?? 'utf8'\n\t\tconst bodyBytes = encoding === 'base64' ? base64ToBytes(input.body) : utf8ToBytes(input.body)\n\t\tif (bodyBytes.byteLength > MAX_MULTIPART_PART_BYTES) {\n\t\t\tthrow new ToolError('Multipart part exceeds 25 MiB upload limit', {\n\t\t\t\tcode: 'too_large',\n\t\t\t\tdetails: { max_bytes: MAX_MULTIPART_PART_BYTES, content_length: bodyBytes.byteLength }\n\t\t\t})\n\t\t}\n\t\tif (bodyBytes.byteLength === 0) {\n\t\t\tthrow new ToolError('Multipart part body must not be empty', { code: 'bad_input' })\n\t\t}\n\t\tconst query = new URLSearchParams({\n\t\t\tpartNumber: String(input.part_number),\n\t\t\tuploadId: input.upload_id\n\t\t})\n\t\tconst response = await this.#aws.put(objectUrl(this.#auth, wireKey, query.toString()), toArrayBuffer(bodyBytes), {\n\t\t\tlabel: 'S3 upload part'\n\t\t})\n\t\tconst etagHeader = response.headers.get('etag')\n\t\tif (!isString(etagHeader) || etagHeader.length === 0) {\n\t\t\tthrow new ToolError('S3 upload part returned no ETag', { code: 'upstream' })\n\t\t}\n\t\treturn {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: input.upload_id,\n\t\t\tpart_number: input.part_number,\n\t\t\tetag: stripEtagQuotes(etagHeader),\n\t\t\tcontent_length: bodyBytes.byteLength\n\t\t}\n\t}\n\n\tasync completeMultipartUpload(input: CompleteMultipartUploadInput): Promise<CompleteMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst sorted = [...input.parts].sort((a, b) => a.part_number - b.part_number)\n\t\tconst partsXml = sorted\n\t\t\t.map((part) => {\n\t\t\t\tconst etag = stripEtagQuotes(part.etag)\n\t\t\t\treturn `<Part><PartNumber>${part.part_number}</PartNumber><ETag>\"${etag}\"</ETag></Part>`\n\t\t\t})\n\t\t\t.join('')\n\t\tconst body = `<CompleteMultipartUpload>${partsXml}</CompleteMultipartUpload>`\n\t\tconst query = new URLSearchParams({ uploadId: input.upload_id })\n\t\tconst response = await this.#aws.bytes('POST', objectUrl(this.#auth, wireKey, query.toString()), {\n\t\t\tlabel: 'S3 complete multipart upload',\n\t\t\tbody,\n\t\t\theaders: { 'Content-Type': 'application/xml' }\n\t\t})\n\t\tconst xml = bytesToUtf8(response.bytes)\n\t\tconst etagRaw = firstXmlText(xml, 'ETag')\n\t\tconst headerEtag = response.headers.get('etag')\n\t\tconst etag = etagRaw ? stripEtagQuotes(etagRaw) : isString(headerEtag) ? stripEtagQuotes(headerEtag) : undefined\n\t\tconst out: CompleteMultipartUploadOutput = {\n\t\t\tkey: this.#publicKey(wireKey),\n\t\t\tupload_id: input.upload_id\n\t\t}\n\t\tif (etag) out.etag = etag\n\t\treturn out\n\t}\n\n\tasync abortMultipartUpload(input: AbortMultipartUploadInput): Promise<AbortMultipartUploadOutput> {\n\t\tconst wireKey = this.#resolve(input.key)\n\t\tconst query = new URLSearchParams({ uploadId: input.upload_id })\n\t\tawait this.#aws.delete(objectUrl(this.#auth, wireKey, query.toString()), {\n\t\t\tlabel: 'S3 abort multipart upload',\n\t\t\tallowStatuses: [404]\n\t\t})\n\t\treturn { key: this.#publicKey(wireKey), upload_id: input.upload_id, aborted: true }\n\t}\n\n\t/** Host-facing raw download. Pass `maxBytes` to enforce a hard download cap. Logical key when key_prefix is set. */\n\tasync getBytes(key: string, options: { maxBytes?: number } = {}): Promise<Uint8Array> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst maxBytes = options.maxBytes\n\t\tif (maxBytes !== undefined) {\n\t\t\tconst { bytes } = await this.#getBoundedWire(wireKey, maxBytes, 'Object exceeds download limit')\n\t\t\treturn bytes\n\t\t}\n\t\ttry {\n\t\t\tconst { bytes } = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), { label: 'S3 get' })\n\t\t\treturn bytes\n\t\t} catch (error) {\n\t\t\tremapNotFound(error)\n\t\t}\n\t}\n\n\tasync getBytesRange(key: string, range: S3ByteRange): Promise<S3ByteRangeResult> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst requestedBytes = range.end_byte - range.start_byte + 1\n\t\tif (\n\t\t\t!Number.isSafeInteger(range.start_byte) ||\n\t\t\t!Number.isSafeInteger(range.end_byte) ||\n\t\t\trange.start_byte < 0 ||\n\t\t\trequestedBytes < 1\n\t\t) {\n\t\t\tthrow new ToolError('Byte range must use non-negative inclusive offsets with end_byte >= start_byte', {\n\t\t\t\tcode: 'bad_input'\n\t\t\t})\n\t\t}\n\t\tif (requestedBytes > MAX_OBJECT_BYTES) {\n\t\t\ttooLarge(MAX_OBJECT_BYTES, requestedBytes, 'Byte range exceeds download limit')\n\t\t}\n\n\t\tconst head = await this.#headWire(wireKey)\n\t\tif (!head.exists) objectNotFound()\n\t\tif (head.content_length !== undefined && range.start_byte >= head.content_length) {\n\t\t\tthrow new ToolError('Byte range starts beyond the end of the object', {\n\t\t\t\tcode: 'bad_input',\n\t\t\t\tdetails: { start_byte: range.start_byte, content_length: head.content_length }\n\t\t\t})\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\tRange: `bytes=${range.start_byte}-${range.end_byte}`\n\t\t}\n\t\tif (head.etag) headers['If-Match'] = head.etag.startsWith('\"') ? head.etag : `\"${head.etag}\"`\n\n\t\tlet response\n\t\ttry {\n\t\t\tresponse = await this.#aws.bytes('GET', objectUrl(this.#auth, wireKey), {\n\t\t\t\tlabel: 'S3 range get',\n\t\t\t\theaders,\n\t\t\t\tmaxBytes: requestedBytes\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tif (isToolError(error) && error.details?.['status'] === 412) {\n\t\t\t\tthrow new ToolError('Object changed during download', {\n\t\t\t\t\tcode: 'upstream',\n\t\t\t\t\tdetails: { status: 412, key: this.#publicKey(wireKey) },\n\t\t\t\t\tcause: error\n\t\t\t\t})\n\t\t\t}\n\t\t\tremapNotFound(error)\n\t\t}\n\n\t\tconst out: S3ByteRangeResult = {\n\t\t\tbytes: response.bytes,\n\t\t\tstart_byte: range.start_byte,\n\t\t\tend_byte: range.start_byte + response.bytes.byteLength - 1\n\t\t}\n\t\tconst totalBytes = contentRangeTotal(response.headers.get('content-range')) ?? head.content_length\n\t\tconst contentType = response.headers.get('content-type') ?? head.content_type\n\t\tif (totalBytes !== undefined) out.total_bytes = totalBytes\n\t\tif (contentType) out.content_type = contentType\n\t\treturn out\n\t}\n\n\t/** Host-facing raw upload. Logical key when key_prefix is set. */\n\tasync putBytes(key: string, bytes: Uint8Array, contentType?: string): Promise<void> {\n\t\tconst wireKey = this.#resolve(key)\n\t\tconst headers: Record<string, string> = {}\n\t\tif (isString(contentType) && contentType.length > 0) headers['Content-Type'] = contentType\n\t\tawait this.#aws.put(objectUrl(this.#auth, wireKey), toArrayBuffer(bytes), {\n\t\t\tlabel: 'S3 put',\n\t\t\theaders\n\t\t})\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { S3Client } from './client'\nimport {\n\tabortMultipartUploadInputSchema,\n\tabortMultipartUploadOutputSchema,\n\tcompleteMultipartUploadInputSchema,\n\tcompleteMultipartUploadOutputSchema,\n\tcopyObjectInputSchema,\n\tcopyObjectOutputSchema,\n\tcreateMultipartUploadInputSchema,\n\tcreateMultipartUploadOutputSchema,\n\tdeleteObjectInputSchema,\n\tdeleteObjectOutputSchema,\n\tgetObjectInputSchema,\n\tgetObjectOutputSchema,\n\theadObjectInputSchema,\n\theadObjectOutputSchema,\n\tlistObjectsInputSchema,\n\tlistObjectsOutputSchema,\n\tputObjectInputSchema,\n\tputObjectOutputSchema,\n\ts3AuthSchema,\n\tsignedUrlInputSchema,\n\tsignedUrlOutputSchema,\n\tuploadPartInputSchema,\n\tuploadPartOutputSchema\n} from './contracts'\n\nexport const s3ListObjectsTool = defineTool({\n\tid: 's3-list-objects',\n\tname: 's3ListObjects',\n\tdescription:\n\t\t'List objects in the bound S3 bucket. Use prefix, delimiter, cursor, and limit for filtered pagination. Returns keys, items with metadata, next_cursor, and truncated.',\n\tinputSchema: listObjectsInputSchema,\n\toutputSchema: listObjectsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).list(input)\n})\n\nexport const s3GetObjectTool = defineTool({\n\tid: 's3-get-object',\n\tname: 's3GetObject',\n\tdescription:\n\t\t'Download one object by key from S3. Bodies larger than 5 MiB fail. Returns body as base64 by default or utf8 when requested.',\n\tinputSchema: getObjectInputSchema,\n\toutputSchema: getObjectOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).get(input)\n})\n\nexport const s3PutObjectTool = defineTool({\n\tid: 's3-put-object',\n\tname: 's3PutObject',\n\tdescription:\n\t\t'Upload or replace one object by key in S3. Provide utf8 text or base64 body. Bodies larger than 5 MiB fail.',\n\tinputSchema: putObjectInputSchema,\n\toutputSchema: putObjectOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).put(input)\n})\n\nexport const s3DeleteObjectTool = defineTool({\n\tid: 's3-delete-object',\n\tname: 's3DeleteObject',\n\tdescription: 'Delete one object by key in S3. Idempotent for missing keys (404 treated as success).',\n\tinputSchema: deleteObjectInputSchema,\n\toutputSchema: deleteObjectOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).delete(input)\n})\n\nexport const s3HeadObjectTool = defineTool({\n\tid: 's3-head-object',\n\tname: 's3HeadObject',\n\tdescription:\n\t\t'Inspect S3 object metadata by key without downloading the body. Returns exists flag plus content type, length, and ETag when present.',\n\tinputSchema: headObjectInputSchema,\n\toutputSchema: headObjectOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).head(input)\n})\n\nexport const s3CopyObjectTool = defineTool({\n\tid: 's3-copy-object',\n\tname: 's3CopyObject',\n\tdescription:\n\t\t'Copy one S3 object to a new key. Set source_bucket only for an allowed cross-bucket copy; otherwise the configured bucket is used.',\n\tinputSchema: copyObjectInputSchema,\n\toutputSchema: copyObjectOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).copy(input)\n})\n\nexport const s3CreateSignedUrlTool = defineTool({\n\tid: 's3-create-signed-url',\n\tname: 's3CreateSignedUrl',\n\tdescription: 'Create a time-limited presigned S3 URL for one object key. Defaults to GET for 3600 seconds.',\n\tinputSchema: signedUrlInputSchema,\n\toutputSchema: signedUrlOutputSchema,\n\tsideEffect: 'none',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).createSignedUrl(input)\n})\n\nexport const s3CreateMultipartUploadTool = defineTool({\n\tid: 's3-create-multipart-upload',\n\tname: 's3CreateMultipartUpload',\n\tdescription:\n\t\t'Start an S3 multipart upload for one object key. Returns upload_id for uploadPart/complete/abort. Use for objects larger than the single put limit.',\n\tinputSchema: createMultipartUploadInputSchema,\n\toutputSchema: createMultipartUploadOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).createMultipartUpload(input)\n})\n\nexport const s3UploadPartTool = defineTool({\n\tid: 's3-upload-part',\n\tname: 's3UploadPart',\n\tdescription:\n\t\t'Upload one part of an in-progress S3 multipart upload. Part bodies up to 25 MiB. S3 requires each part except the last to be at least 5 MiB. Returns etag required for completeMultipartUpload.',\n\tinputSchema: uploadPartInputSchema,\n\toutputSchema: uploadPartOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).uploadPart(input)\n})\n\nexport const s3CompleteMultipartUploadTool = defineTool({\n\tid: 's3-complete-multipart-upload',\n\tname: 's3CompleteMultipartUpload',\n\tdescription:\n\t\t'Finish an S3 multipart upload by assembling uploaded parts (part_number + etag). Parts may be supplied in any order; they are sorted by part_number before complete.',\n\tinputSchema: completeMultipartUploadInputSchema,\n\toutputSchema: completeMultipartUploadOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).completeMultipartUpload(input)\n})\n\nexport const s3AbortMultipartUploadTool = defineTool({\n\tid: 's3-abort-multipart-upload',\n\tname: 's3AbortMultipartUpload',\n\tdescription: 'Abort an in-progress S3 multipart upload and discard uploaded parts for that upload_id.',\n\tinputSchema: abortMultipartUploadInputSchema,\n\toutputSchema: abortMultipartUploadOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => S3Client.fromContext(ctx).abortMultipartUpload(input)\n})\n\nexport const s3Module = defineModule({\n\tid: 's3',\n\ttitle: 'S3 / S3-compatible',\n\tdescription:\n\t\t'Store and retrieve objects with S3-compatible storage. Use for object listing, reads, writes, metadata, copies, deletion, signed URLs, and multipart uploads.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: s3AuthSchema },\n\tcategories: ['storage', 'aws'],\n\tclassification: 'pii',\n\ttags: ['object-store'],\n\ttools: [\n\t\ts3ListObjectsTool,\n\t\ts3GetObjectTool,\n\t\ts3PutObjectTool,\n\t\ts3DeleteObjectTool,\n\t\ts3HeadObjectTool,\n\t\ts3CopyObjectTool,\n\t\ts3CreateSignedUrlTool,\n\t\ts3CreateMultipartUploadTool,\n\t\ts3UploadPartTool,\n\t\ts3CompleteMultipartUploadTool,\n\t\ts3Ab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SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,sBAAsB,KAAK;AACrF,CAAC;AAED,MAAa,mBAAmB,WAAW;CAC1C,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,WAAW,KAAK;AAC1E,CAAC;AAED,MAAa,gCAAgC,WAAW;CACvD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,wBAAwB,KAAK;AACvF,CAAC;AAED,MAAa,6BAA6B,WAAW;CACpD,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,SAAS,YAAY,GAAG,CAAC,CAAC,qBAAqB,KAAK;AACpF,CAAC;AAED,MAAa,WAAW,aAAa;CACpC,IAAI;CACJ,OAAO;CACP,aACC;CACD,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAa;CAC7C,YAAY,CAAC,WAAW,KAAK;CAC7B,gBAAgB;CAChB,MAAM,CAAC,cAAc;CACrB,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD,CAAC"}
|
|
@@ -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-DdFALdNf.js";
|
|
3
3
|
import { n as requireAuth } from "./provider-CgDAlg6K.js";
|
|
4
4
|
import { t as HttpService } from "./http-service-BMBIryAL.js";
|
|
5
5
|
import { a as toArrayBuffer, n as bytesToBase64, t as base64ToBytes } from "./bytes-BxpimpQx.js";
|
|
@@ -1452,4 +1452,4 @@ function firstString(...values) {
|
|
|
1452
1452
|
//#endregion
|
|
1453
1453
|
export { slackSetAssistantStatusInputSchema as $, slackAuthSchema as A, slackGetBotOutputSchema as B, isSlackOutcomeUnknown as C, slackAppendStreamInputSchema as D, slackAnswerCallbackInputSchema as E, slackConversationMessagesOutputSchema as F, slackPostEphemeralInputSchema as G, slackListConversationsOutputSchema as H, slackConversationRepliesInputSchema as I, slackSendMediaBatchInputSchema as J, slackPublishHomeInputSchema as K, slackDownloadFileInputSchema as L, slackConversationHistoryInputSchema as M, slackConversationInfoInputSchema as N, slackAuthRevokeInputSchema as O, slackConversationInfoOutputSchema as P, slackSendTextInputSchema as Q, slackDownloadFileOutputSchema as R, isSlackDefiniteRejection as S, MAX_SLACK_MEDIA_BATCH as T, slackMessageOutputSchema as U, slackListConversationsInputSchema as V, slackOkOutputSchema as W, slackSendMediaBatchOutputSchema as X, slackSendMediaBatchItemSchema as Y, slackSendMediaInputSchema as Z, slackSendMediaTool as _, formatSlackChannelRef as a, slackUsersConversationsInputSchema as at, SlackClient as b, slackMrkdwnToPlainText as c, slackClearReactionTool as d, slackSetReactionInputSchema as et, slackDownloadFileTool as f, slackSendChatActionTool as g, slackModule as h, extractSlackUserMentions as i, slackStopTypingInputSchema as it, slackClearReactionInputSchema as j, slackAuthRevokeOutputSchema as k, stripLeadingSlackBotMention as l, slackGetBotTool as m, verifySlackRequestSignature as n, slackStartStreamInputSchema as nt, formatSlackMessagePermalink as o, slackUsersInfoInputSchema as ot, slackEditTextTool as p, slackSendChatActionInputSchema as q, extractSlackChannelRefs as r, slackStopStreamInputSchema as rt, formatSlackUserMention as s, slackUsersInfoOutputSchema as st, parseSlackEvent as t, slackSetSuggestedPromptsInputSchema as tt, slackAnswerCallbackTool as u, slackSendTextTool as v, MAX_MEDIA_BYTES as w, SlackClientError as x, slackSetReactionTool as y, slackEditTextInputSchema as z };
|
|
1454
1454
|
|
|
1455
|
-
//# sourceMappingURL=slack-
|
|
1455
|
+
//# sourceMappingURL=slack-D6XzBS3b.js.map
|