@5ss/ai-tools 3.7.3 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -0
  3. package/dist/{bedrock-agentcore-browser-yrEY9cUi.js → bedrock-agentcore-browser-DINOmO6a.js} +2 -2
  4. package/dist/{bedrock-agentcore-browser-yrEY9cUi.js.map → bedrock-agentcore-browser-DINOmO6a.js.map} +1 -1
  5. package/dist/{bedrock-agentcore-code-interpreter-BnJnDxCp.js → bedrock-agentcore-code-interpreter-Doon_lrN.js} +2 -2
  6. package/dist/{bedrock-agentcore-code-interpreter-BnJnDxCp.js.map → bedrock-agentcore-code-interpreter-Doon_lrN.js.map} +1 -1
  7. package/dist/{cloudflare-browser-D9pG4RTj.js → cloudflare-browser-Ct8U4_Ru.js} +3 -3
  8. package/dist/{cloudflare-browser-D9pG4RTj.js.map → cloudflare-browser-Ct8U4_Ru.js.map} +1 -1
  9. package/dist/{cloudflare-email-bsq902dg.js → cloudflare-email-oS9Ku8a6.js} +2 -2
  10. package/dist/{cloudflare-email-bsq902dg.js.map → cloudflare-email-oS9Ku8a6.js.map} +1 -1
  11. package/dist/{cloudflare-sandbox-DHE4fmiq.js → cloudflare-sandbox-kpfw9aT6.js} +3 -3
  12. package/dist/{cloudflare-sandbox-DHE4fmiq.js.map → cloudflare-sandbox-kpfw9aT6.js.map} +1 -1
  13. package/dist/core/index.js +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/{define-DdFALdNf.js → define-CbQI8dAN.js} +2 -1
  16. package/dist/{define-DdFALdNf.js.map → define-CbQI8dAN.js.map} +1 -1
  17. package/dist/{eventbridge-scheduler-ICepMPWG.js → eventbridge-scheduler-CTgSZgZZ.js} +2 -2
  18. package/dist/{eventbridge-scheduler-ICepMPWG.js.map → eventbridge-scheduler-CTgSZgZZ.js.map} +1 -1
  19. package/dist/{imessage-B-0DZfMa.js → imessage-u90N3KVq.js} +2 -2
  20. package/dist/{imessage-B-0DZfMa.js.map → imessage-u90N3KVq.js.map} +1 -1
  21. package/dist/index-ByHp3nZm.d.ts.map +1 -1
  22. package/dist/index-CZX5OeOF.d.ts.map +1 -1
  23. package/dist/{mastra-vector-qKG3L-Rw.js → mastra-vector-BillORtZ.js} +2 -2
  24. package/dist/{mastra-vector-qKG3L-Rw.js.map → mastra-vector-BillORtZ.js.map} +1 -1
  25. package/dist/modules/artifacts/index.js +2 -2
  26. package/dist/modules/browser/index.js +3 -3
  27. package/dist/modules/calendar/index.js +1 -1
  28. package/dist/modules/code-sandbox/index.js +3 -3
  29. package/dist/modules/content-type/index.js +1 -1
  30. package/dist/modules/crypto/index.js +1 -1
  31. package/dist/modules/document-extract/index.js +2 -2
  32. package/dist/modules/document-render/index.js +2 -2
  33. package/dist/modules/email/index.js +3 -3
  34. package/dist/modules/email-message/index.js +1 -1
  35. package/dist/modules/files/index.js +2 -2
  36. package/dist/modules/image/index.js +2 -2
  37. package/dist/modules/messaging/index.js +6 -6
  38. package/dist/modules/queue/index.js +2 -2
  39. package/dist/modules/rag/index.js +2 -2
  40. package/dist/modules/scheduler/index.js +2 -2
  41. package/dist/modules/skills/index.js +1 -1
  42. package/dist/modules/tasks/index.js +1 -1
  43. package/dist/modules/vector-store/index.js +1 -1
  44. package/dist/modules/web-fetch/index.js +1 -1
  45. package/dist/{pinecone-tmtu3ZS5.js → pinecone-CLetgKeA.js} +2 -2
  46. package/dist/{pinecone-tmtu3ZS5.js.map → pinecone-CLetgKeA.js.map} +1 -1
  47. package/dist/{qdrant-zbCHUsnv.js → qdrant-DhnitNEu.js} +2 -2
  48. package/dist/{qdrant-zbCHUsnv.js.map → qdrant-DhnitNEu.js.map} +1 -1
  49. package/dist/{resend-Cfgm4HuV.js → resend-BBrjcYvB.js} +2 -2
  50. package/dist/{resend-Cfgm4HuV.js.map → resend-BBrjcYvB.js.map} +1 -1
  51. package/dist/{s3-TKCIZZ2q.js → s3-BpivS7pv.js} +36 -21
  52. package/dist/s3-BpivS7pv.js.map +1 -0
  53. package/dist/{slack-D6XzBS3b.js → slack-D9OmRfO9.js} +2 -2
  54. package/dist/{slack-D6XzBS3b.js.map → slack-D9OmRfO9.js.map} +1 -1
  55. package/dist/{sqs-B50DWyTf.js → sqs-BPNYdTpw.js} +2 -2
  56. package/dist/{sqs-B50DWyTf.js.map → sqs-BPNYdTpw.js.map} +1 -1
  57. package/dist/{supabase-vector-CDKOyvj1.js → supabase-vector-wRNCS3GC.js} +2 -2
  58. package/dist/{supabase-vector-CDKOyvj1.js.map → supabase-vector-wRNCS3GC.js.map} +1 -1
  59. package/dist/{teams-bGfle6pU.js → teams-SteU8V5H.js} +2 -2
  60. package/dist/{teams-bGfle6pU.js.map → teams-SteU8V5H.js.map} +1 -1
  61. package/dist/{telegram-B-TZi9fM.js → telegram-Buo2ZFGj.js} +2 -2
  62. package/dist/{telegram-B-TZi9fM.js.map → telegram-Buo2ZFGj.js.map} +1 -1
  63. package/dist/{textract-CthgcP6w.js → textract-BCNadrCr.js} +3 -3
  64. package/dist/{textract-CthgcP6w.js.map → textract-BCNadrCr.js.map} +1 -1
  65. package/dist/{vector-store-DrwuMOne.js → vector-store-DvqvDSLb.js} +6 -6
  66. package/dist/{vector-store-DrwuMOne.js.map → vector-store-DvqvDSLb.js.map} +1 -1
  67. package/dist/vendors/amazon-sp-api/index.js +1 -1
  68. package/dist/vendors/bedrock-agentcore-browser/index.js +1 -1
  69. package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +1 -1
  70. package/dist/vendors/cloudflare-browser/index.js +1 -1
  71. package/dist/vendors/cloudflare-email/index.js +1 -1
  72. package/dist/vendors/cloudflare-sandbox/index.js +1 -1
  73. package/dist/vendors/eventbridge-scheduler/index.js +1 -1
  74. package/dist/vendors/imessage/index.js +1 -1
  75. package/dist/vendors/katana/index.js +1 -1
  76. package/dist/vendors/mastra-vector/index.js +1 -1
  77. package/dist/vendors/pinecone/index.js +1 -1
  78. package/dist/vendors/qdrant/index.js +1 -1
  79. package/dist/vendors/resend/index.js +1 -1
  80. package/dist/vendors/s3/index.js +1 -1
  81. package/dist/vendors/shipstation/index.js +1 -1
  82. package/dist/vendors/slack/index.js +1 -1
  83. package/dist/vendors/sqs/index.js +1 -1
  84. package/dist/vendors/supabase-vector/index.js +1 -1
  85. package/dist/vendors/teams/index.js +1 -1
  86. package/dist/vendors/telegram/index.js +1 -1
  87. package/dist/vendors/textract/index.js +1 -1
  88. package/dist/vendors/walmart/index.d.ts +421 -0
  89. package/dist/vendors/walmart/index.d.ts.map +1 -0
  90. package/dist/vendors/walmart/index.js +517 -0
  91. package/dist/vendors/walmart/index.js.map +1 -0
  92. package/dist/vendors/woocommerce/index.js +1 -1
  93. package/logos/README.md +1 -0
  94. package/logos/pack-logos.json +1 -0
  95. package/logos/walmart.svg +8 -0
  96. package/package.json +5 -1
  97. package/dist/s3-TKCIZZ2q.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { t as ToolError } from "./errors-DoSpNHvs.js";
2
- import { n as defineModule, r as defineTool } from "./define-DdFALdNf.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CbQI8dAN.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 { C as resolveVectorNamespace, _ as parseMetadata, a as deleteVectorsOutputSchema, c as upsertVectorsInputSchema, g as mergeVectorFilter, i as deleteVectorsInputSchema, l as upsertVectorsOutputSchema, m as mapVectorHttpStatus, o as queryVectorsInputSchema, s as queryVectorsOutputSchema, u as vectorDefaultFilterSchema, v as parseNumberArray, w as stampDefaultFilterMetadata, x as parseUpstreamMessage, y as parsePointId } from "./schemas-ChOAhdo9.js";
@@ -187,4 +187,4 @@ const pineconeModule = defineModule({
187
187
  //#endregion
188
188
  export { PineconeClient as a, pineconeUpsertTool as i, pineconeModule as n, pineconeAuthSchema as o, pineconeQueryTool as r, pineconeDeleteTool as t };
189
189
 
190
- //# sourceMappingURL=pinecone-tmtu3ZS5.js.map
190
+ //# sourceMappingURL=pinecone-CLetgKeA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pinecone-tmtu3ZS5.js","names":["#http","#defaultNamespace","#defaultFilter","#namespace"],"sources":["../src/vendors/pinecone/contracts.ts","../src/vendors/pinecone/client.ts","../src/vendors/pinecone/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { vectorDefaultFilterSchema } from '../_vector'\n\nexport {\n\tMAX_TOP_K,\n\tMAX_VECTOR_BATCH,\n\tMAX_VECTOR_DIMENSIONS,\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema,\n\tvectorMatchSchema,\n\tvectorMetadataSchema,\n\tvectorPointSchema\n} from '../_vector'\nexport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch,\n\tVectorMetadata,\n\tVectorPoint\n} from '../_vector'\n\nexport const pineconeAuthSchema = z.object({\n\tapi_key: z.string().min(1).describe('Pinecone API key'),\n\tbase_url: z.string().url().describe('Pinecone index data-plane origin, for example https://xxxx.svc.….pinecone.io'),\n\tdefault_namespace: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe('Locked Pinecone namespace for all calls when set (tool cannot switch away)'),\n\tdefault_filter: vectorDefaultFilterSchema\n\t\t.optional()\n\t\t.describe('Host-bound metadata filter always applied on query; flat keys stamped on upsert')\n})\n\nexport type PineconeAuth = z.infer<typeof pineconeAuthSchema>\n","/**\n * Pinecone data-plane REST vendor client.\n * Host: `new PineconeClient(auth)`. Agent tools: `fromContext(ctx)`.\n * @see https://docs.pinecone.io/reference/api/data-plane\n */\n\nimport { isNumber, isPlainObject } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport {\n\tmapVectorHttpStatus,\n\tmergeVectorFilter,\n\tparseMetadata,\n\tparseNumberArray,\n\tparsePointId,\n\tparseUpstreamMessage,\n\tresolveVectorNamespace,\n\tstampDefaultFilterMetadata\n} from '../_vector/domain'\nimport type { VectorDefaultFilter } from '../_vector/domain'\nimport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tPineconeAuth,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch\n} from './contracts'\nimport { pineconeAuthSchema } from './contracts'\n\nexport type PineconeClientOptions = {\n\tfetch?: HttpServiceOptions['fetch'] | undefined\n\tsignal?: HttpServiceOptions['signal'] | undefined\n}\n\nexport class PineconeClient {\n\treadonly #http: HttpService\n\treadonly #defaultNamespace: string | undefined\n\treadonly #defaultFilter: VectorDefaultFilter | undefined\n\n\tconstructor(auth: PineconeAuth, options: PineconeClientOptions = {}) {\n\t\tconst parsed = pineconeAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Pinecone 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.#defaultNamespace = parsed.data.default_namespace\n\t\tthis.#defaultFilter = parsed.data.default_filter\n\t\tconst httpOptions: HttpServiceOptions = {\n\t\t\tbaseURL: parsed.data.base_url,\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Api-Key': parsed.data.api_key\n\t\t\t},\n\t\t\tlabel: 'Pinecone'\n\t\t}\n\t\tif (options.fetch) httpOptions.fetch = options.fetch\n\t\tif (options.signal) httpOptions.signal = options.signal\n\t\tthis.#http = new HttpService(httpOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): PineconeClient {\n\t\tconst auth = requireAuth(ctx, pineconeAuthSchema)\n\t\tconst options: PineconeClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new PineconeClient(auth, options)\n\t}\n\n\t#namespace(toolNamespace: string | undefined): string | undefined {\n\t\treturn resolveVectorNamespace(this.#defaultNamespace, toolNamespace)\n\t}\n\n\tasync upsert(input: UpsertVectorsInput): Promise<UpsertVectorsOutput> {\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvectors: input.vectors.map((point) => {\n\t\t\t\tconst metadata = stampDefaultFilterMetadata(point.metadata, this.#defaultFilter)\n\t\t\t\tconst row: Record<string, unknown> = { id: point.id, values: point.values }\n\t\t\t\tif (metadata) row['metadata'] = metadata\n\t\t\t\treturn row\n\t\t\t})\n\t\t}\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\n\t\tconst res = await this.#http.post('/vectors/upsert', body, {\n\t\t\tlabel: 'Pinecone upsert',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone upsert failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\tconst upserted =\n\t\t\tisPlainObject(res.data) && isNumber(res.data['upsertedCount']) ? res.data['upsertedCount'] : input.vectors.length\n\t\treturn { upserted }\n\t}\n\n\tasync query(input: QueryVectorsInput): Promise<QueryVectorsOutput> {\n\t\tconst topK = input.top_k ?? 8\n\t\tconst includeMetadata = input.include_metadata !== false\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvector: input.vector,\n\t\t\ttopK,\n\t\t\tincludeMetadata,\n\t\t\tincludeValues: input.include_values === true\n\t\t}\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\t\tconst filter = mergeVectorFilter(this.#defaultFilter, input.filter)\n\t\tif (filter) body['filter'] = filter\n\n\t\tconst res = await this.#http.post('/query', body, { label: 'Pinecone query', noThrow: true })\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone query failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\n\t\tconst matchesRaw = isPlainObject(res.data) ? res.data['matches'] : undefined\n\t\tconst rows = Array.isArray(matchesRaw) ? matchesRaw : []\n\t\tconst matches: VectorMatch[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (!isPlainObject(row)) continue\n\t\t\tconst id = parsePointId(row['id'])\n\t\t\tif (!id) continue\n\t\t\tconst score = isNumber(row['score']) ? row['score'] : 0\n\t\t\tconst match: VectorMatch = { id, score }\n\t\t\tif (includeMetadata) {\n\t\t\t\tconst meta = parseMetadata(row['metadata'])\n\t\t\t\tif (meta) match.metadata = meta\n\t\t\t}\n\t\t\tif (input.include_values === true) {\n\t\t\t\tconst values = parseNumberArray(row['values'])\n\t\t\t\tif (values) match.values = values\n\t\t\t}\n\t\t\tmatches.push(match)\n\t\t}\n\t\treturn { matches }\n\t}\n\n\tasync delete(input: DeleteVectorsInput): Promise<DeleteVectorsOutput> {\n\t\tconst body: Record<string, unknown> = { ids: input.ids }\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\n\t\tconst res = await this.#http.post('/vectors/delete', body, {\n\t\t\tlabel: 'Pinecone delete',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone delete failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { deleted: input.ids.length }\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { PineconeClient } from './client'\nimport {\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tpineconeAuthSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema\n} from './contracts'\n\nexport const pineconeUpsertTool = defineTool({\n\tid: 'pinecone-upsert',\n\tname: 'pineconeUpsert',\n\tdescription:\n\t\t'Upsert vectors into the configured Pinecone index. Use the optional namespace only when data must be isolated within the index.',\n\tinputSchema: upsertVectorsInputSchema,\n\toutputSchema: upsertVectorsOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).upsert(input)\n})\n\nexport const pineconeQueryTool = defineTool({\n\tid: 'pinecone-query',\n\tname: 'pineconeQuery',\n\tdescription: 'Nearest-neighbor query against the bound Pinecone index.',\n\tinputSchema: queryVectorsInputSchema,\n\toutputSchema: queryVectorsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).query(input)\n})\n\nexport const pineconeDeleteTool = defineTool({\n\tid: 'pinecone-delete',\n\tname: 'pineconeDelete',\n\tdescription: 'Delete vectors by id from the bound Pinecone index.',\n\tinputSchema: deleteVectorsInputSchema,\n\toutputSchema: deleteVectorsOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).delete(input)\n})\n\nexport const pineconeModule = defineModule({\n\tid: 'pinecone',\n\ttitle: 'Pinecone',\n\tdescription: 'Pinecone data-plane REST: upsert, query, and delete vectors in a bound index.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: pineconeAuthSchema },\n\tcategories: ['ai', 'vector'],\n\tclassification: 'pii',\n\ttags: ['pinecone'],\n\ttools: [pineconeUpsertTool, pineconeQueryTool,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qB,WAAW;CAC5C,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,eAAe,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AAC5E,CAAC;AAED,MAAa,oBAAoB,WAAW;CAC3C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,eAAe,YAAY,GAAG,CAAC,CAAC,MAAM,KAAK;AAC3E,CAAC;AAED,MAAa,qBAAqB,WAAW;CAC5C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,eAAe,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AAC5E,CAAC;AAED,MAAa,iBAAiB,aAAa;CAC1C,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAmB;CACnD,YAAY,CAAC,MAAM,QAAQ;CAC3B,gBAAgB;CAChB,MAAM,CAAC,UAAU;CACjB,OAAO;EAAC;EAAoB;EAAmB;CAAkB;AAClE,CAAC"}
1
+ {"version":3,"file":"pinecone-CLetgKeA.js","names":["#http","#defaultNamespace","#defaultFilter","#namespace"],"sources":["../src/vendors/pinecone/contracts.ts","../src/vendors/pinecone/client.ts","../src/vendors/pinecone/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { vectorDefaultFilterSchema } from '../_vector'\n\nexport {\n\tMAX_TOP_K,\n\tMAX_VECTOR_BATCH,\n\tMAX_VECTOR_DIMENSIONS,\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema,\n\tvectorMatchSchema,\n\tvectorMetadataSchema,\n\tvectorPointSchema\n} from '../_vector'\nexport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch,\n\tVectorMetadata,\n\tVectorPoint\n} from '../_vector'\n\nexport const pineconeAuthSchema = z.object({\n\tapi_key: z.string().min(1).describe('Pinecone API key'),\n\tbase_url: z.string().url().describe('Pinecone index data-plane origin, for example https://xxxx.svc.….pinecone.io'),\n\tdefault_namespace: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe('Locked Pinecone namespace for all calls when set (tool cannot switch away)'),\n\tdefault_filter: vectorDefaultFilterSchema\n\t\t.optional()\n\t\t.describe('Host-bound metadata filter always applied on query; flat keys stamped on upsert')\n})\n\nexport type PineconeAuth = z.infer<typeof pineconeAuthSchema>\n","/**\n * Pinecone data-plane REST vendor client.\n * Host: `new PineconeClient(auth)`. Agent tools: `fromContext(ctx)`.\n * @see https://docs.pinecone.io/reference/api/data-plane\n */\n\nimport { isNumber, isPlainObject } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport {\n\tmapVectorHttpStatus,\n\tmergeVectorFilter,\n\tparseMetadata,\n\tparseNumberArray,\n\tparsePointId,\n\tparseUpstreamMessage,\n\tresolveVectorNamespace,\n\tstampDefaultFilterMetadata\n} from '../_vector/domain'\nimport type { VectorDefaultFilter } from '../_vector/domain'\nimport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tPineconeAuth,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch\n} from './contracts'\nimport { pineconeAuthSchema } from './contracts'\n\nexport type PineconeClientOptions = {\n\tfetch?: HttpServiceOptions['fetch'] | undefined\n\tsignal?: HttpServiceOptions['signal'] | undefined\n}\n\nexport class PineconeClient {\n\treadonly #http: HttpService\n\treadonly #defaultNamespace: string | undefined\n\treadonly #defaultFilter: VectorDefaultFilter | undefined\n\n\tconstructor(auth: PineconeAuth, options: PineconeClientOptions = {}) {\n\t\tconst parsed = pineconeAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Pinecone 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.#defaultNamespace = parsed.data.default_namespace\n\t\tthis.#defaultFilter = parsed.data.default_filter\n\t\tconst httpOptions: HttpServiceOptions = {\n\t\t\tbaseURL: parsed.data.base_url,\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Api-Key': parsed.data.api_key\n\t\t\t},\n\t\t\tlabel: 'Pinecone'\n\t\t}\n\t\tif (options.fetch) httpOptions.fetch = options.fetch\n\t\tif (options.signal) httpOptions.signal = options.signal\n\t\tthis.#http = new HttpService(httpOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): PineconeClient {\n\t\tconst auth = requireAuth(ctx, pineconeAuthSchema)\n\t\tconst options: PineconeClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new PineconeClient(auth, options)\n\t}\n\n\t#namespace(toolNamespace: string | undefined): string | undefined {\n\t\treturn resolveVectorNamespace(this.#defaultNamespace, toolNamespace)\n\t}\n\n\tasync upsert(input: UpsertVectorsInput): Promise<UpsertVectorsOutput> {\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvectors: input.vectors.map((point) => {\n\t\t\t\tconst metadata = stampDefaultFilterMetadata(point.metadata, this.#defaultFilter)\n\t\t\t\tconst row: Record<string, unknown> = { id: point.id, values: point.values }\n\t\t\t\tif (metadata) row['metadata'] = metadata\n\t\t\t\treturn row\n\t\t\t})\n\t\t}\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\n\t\tconst res = await this.#http.post('/vectors/upsert', body, {\n\t\t\tlabel: 'Pinecone upsert',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone upsert failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\tconst upserted =\n\t\t\tisPlainObject(res.data) && isNumber(res.data['upsertedCount']) ? res.data['upsertedCount'] : input.vectors.length\n\t\treturn { upserted }\n\t}\n\n\tasync query(input: QueryVectorsInput): Promise<QueryVectorsOutput> {\n\t\tconst topK = input.top_k ?? 8\n\t\tconst includeMetadata = input.include_metadata !== false\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvector: input.vector,\n\t\t\ttopK,\n\t\t\tincludeMetadata,\n\t\t\tincludeValues: input.include_values === true\n\t\t}\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\t\tconst filter = mergeVectorFilter(this.#defaultFilter, input.filter)\n\t\tif (filter) body['filter'] = filter\n\n\t\tconst res = await this.#http.post('/query', body, { label: 'Pinecone query', noThrow: true })\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone query failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\n\t\tconst matchesRaw = isPlainObject(res.data) ? res.data['matches'] : undefined\n\t\tconst rows = Array.isArray(matchesRaw) ? matchesRaw : []\n\t\tconst matches: VectorMatch[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (!isPlainObject(row)) continue\n\t\t\tconst id = parsePointId(row['id'])\n\t\t\tif (!id) continue\n\t\t\tconst score = isNumber(row['score']) ? row['score'] : 0\n\t\t\tconst match: VectorMatch = { id, score }\n\t\t\tif (includeMetadata) {\n\t\t\t\tconst meta = parseMetadata(row['metadata'])\n\t\t\t\tif (meta) match.metadata = meta\n\t\t\t}\n\t\t\tif (input.include_values === true) {\n\t\t\t\tconst values = parseNumberArray(row['values'])\n\t\t\t\tif (values) match.values = values\n\t\t\t}\n\t\t\tmatches.push(match)\n\t\t}\n\t\treturn { matches }\n\t}\n\n\tasync delete(input: DeleteVectorsInput): Promise<DeleteVectorsOutput> {\n\t\tconst body: Record<string, unknown> = { ids: input.ids }\n\t\tconst ns = this.#namespace(input.namespace)\n\t\tif (ns) body['namespace'] = ns\n\n\t\tconst res = await this.#http.post('/vectors/delete', body, {\n\t\t\tlabel: 'Pinecone delete',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Pinecone delete failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { deleted: input.ids.length }\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { PineconeClient } from './client'\nimport {\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tpineconeAuthSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema\n} from './contracts'\n\nexport const pineconeUpsertTool = defineTool({\n\tid: 'pinecone-upsert',\n\tname: 'pineconeUpsert',\n\tdescription:\n\t\t'Upsert vectors into the configured Pinecone index. Use the optional namespace only when data must be isolated within the index.',\n\tinputSchema: upsertVectorsInputSchema,\n\toutputSchema: upsertVectorsOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).upsert(input)\n})\n\nexport const pineconeQueryTool = defineTool({\n\tid: 'pinecone-query',\n\tname: 'pineconeQuery',\n\tdescription: 'Nearest-neighbor query against the bound Pinecone index.',\n\tinputSchema: queryVectorsInputSchema,\n\toutputSchema: queryVectorsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).query(input)\n})\n\nexport const pineconeDeleteTool = defineTool({\n\tid: 'pinecone-delete',\n\tname: 'pineconeDelete',\n\tdescription: 'Delete vectors by id from the bound Pinecone index.',\n\tinputSchema: deleteVectorsInputSchema,\n\toutputSchema: deleteVectorsOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => PineconeClient.fromContext(ctx).delete(input)\n})\n\nexport const pineconeModule = defineModule({\n\tid: 'pinecone',\n\ttitle: 'Pinecone',\n\tdescription: 'Pinecone data-plane REST: upsert, query, and delete vectors in a bound index.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: pineconeAuthSchema },\n\tcategories: ['ai', 'vector'],\n\tclassification: 'pii',\n\ttags: ['pinecone'],\n\ttools: [pineconeUpsertTool, pineconeQueryTool, pineconeDeleteTool]\n})\n"],"mappings":";;;;;;;;AA8BA,MAAa,qBAAqB,EAAE,OAAO;CAC1C,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,kBAAkB;CACtD,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,8EAA8E;CAClH,mBAAmB,EACjB,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,4EAA4E;CACvF,gBAAgB,0BACd,SAAS,CAAC,CACV,SAAS,iFAAiF;AAC7F,CAAC;;;;;;;;ACAD,IAAa,iBAAb,MAAa,eAAe;CAC3B;CACA;CACA;CAEA,YAAY,MAAoB,UAAiC,CAAC,GAAG;EACpE,MAAM,SAAS,mBAAmB,UAAU,IAAI;EAChD,IAAI,CAAC,OAAO,SACX,MAAM,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AK;AAC5E,CAAC;AAED,MAAa,iBAAiB,aAAa;CAC1C,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAmB;CACnD,YAAY,CAAC,MAAM,QAAQ;CAC3B,gBAAgB;CAChB,MAAM,CAAC,UAAU;CACjB,OAAO;EAAC;EAAoB;EAAmB;CAAkB;AAClE,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-DdFALdNf.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CbQI8dAN.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 { S as requireCollection, _ as parseMetadata, a as deleteVectorsOutputSchema, c as upsertVectorsInputSchema, h as mergeQdrantFilter, i as deleteVectorsInputSchema, l as upsertVectorsOutputSchema, m as mapVectorHttpStatus, o as queryVectorsInputSchema, s as queryVectorsOutputSchema, u as vectorDefaultFilterSchema, v as parseNumberArray, w as stampDefaultFilterMetadata, x as parseUpstreamMessage, y as parsePointId } from "./schemas-ChOAhdo9.js";
@@ -250,4 +250,4 @@ const qdrantModule = defineModule({
250
250
  //#endregion
251
251
  export { QdrantClient as a, qdrantUpsertTool as i, qdrantModule as n, qdrantAuthSchema as o, qdrantQueryTool as r, qdrantDeleteTool as t };
252
252
 
253
- //# sourceMappingURL=qdrant-zbCHUsnv.js.map
253
+ //# sourceMappingURL=qdrant-DhnitNEu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qdrant-zbCHUsnv.js","names":["#http","#defaultCollection","#defaultFilter"],"sources":["../src/vendors/qdrant/contracts.ts","../src/vendors/qdrant/domain.ts","../src/vendors/qdrant/client.ts","../src/vendors/qdrant/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { vectorDefaultFilterSchema } from '../_vector'\n\nexport {\n\tMAX_TOP_K,\n\tMAX_VECTOR_BATCH,\n\tMAX_VECTOR_DIMENSIONS,\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema,\n\tvectorMatchSchema,\n\tvectorMetadataSchema,\n\tvectorPointSchema\n} from '../_vector'\nexport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch,\n\tVectorMetadata,\n\tVectorPoint\n} from '../_vector'\n\nexport const qdrantAuthSchema = z.object({\n\tbase_url: z\n\t\t.string()\n\t\t.url()\n\t\t.describe('Qdrant HTTP origin, for example http://127.0.0.1:6333 or https://xxx.cloud.qdrant.io'),\n\tapi_key: z.string().min(1).optional().describe('Optional Qdrant API key'),\n\tdefault_collection: z.string().min(1).optional().describe('Default collection name when tool input omits collection'),\n\tdefault_filter: vectorDefaultFilterSchema\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Host-bound filter always applied on query (flat equality or native Qdrant must/should); flat keys stamped on upsert'\n\t\t)\n})\n\nexport type QdrantAuth = z.infer<typeof qdrantAuthSchema>\n","/**\n * Qdrant point-id helpers. Qdrant only accepts unsigned integers or UUIDs;\n * free-form string ids (e.g. RAG `doc#0`) are mapped to a deterministic UUID\n * and the original id is stored under `__logical_id` in the payload.\n */\n\nimport { createHash } from 'node:crypto'\n\nimport { isString } from 'es-toolkit'\n\nexport const QDRANT_LOGICAL_ID_KEY = '__logical_id'\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\nconst UINT_RE = /^(0|[1-9]\\d*)$/\n\n/** Deterministic UUID (SHA-256 → RFC-like layout) for free-form logical ids. */\nexport function hashToUuid(value: string): string {\n\tconst bytes = Uint8Array.from(createHash('sha256').update(value).digest().subarray(0, 16))\n\tconst versionByte = bytes.at(6)\n\tconst variantByte = bytes.at(8)\n\tif (versionByte === undefined || variantByte === undefined) {\n\t\tthrow new Error('SHA-256 digest shorter than 16 bytes')\n\t}\n\tbytes[6] = (versionByte & 0x0f) | 0x50\n\tbytes[8] = (variantByte & 0x3f) | 0x80\n\tconst hex = Buffer.from(bytes).toString('hex')\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`\n}\n\n/** Map package logical point id → Qdrant wire id. */\nexport function toQdrantPointId(logicalId: string): string | number {\n\tif (UINT_RE.test(logicalId)) {\n\t\tconst n = Number(logicalId)\n\t\tif (Number.isSafeInteger(n) && n >= 0) return n\n\t}\n\tif (UUID_RE.test(logicalId)) return logicalId.toLowerCase()\n\treturn hashToUuid(logicalId)\n}\n\nexport function isNativeQdrantId(logicalId: string): boolean {\n\tif (UINT_RE.test(logicalId)) {\n\t\tconst n = Number(logicalId)\n\t\treturn Number.isSafeInteger(n) && n >= 0\n\t}\n\treturn UUID_RE.test(logicalId)\n}\n\n/** Prefer payload `__logical_id` when present so free-form ids round-trip. */\nexport function resolveLogicalPointId(wireId: string, payload: Record<string, unknown> | undefined): string {\n\tconst logical = payload?.[QDRANT_LOGICAL_ID_KEY]\n\tif (isString(logical) && logical.length > 0) return logical\n\treturn wireId\n}\n\nexport function stripLogicalIdPayload(\n\tpayload: Record<string, string | number | boolean | null> | undefined\n): Record<string, string | number | boolean | null> | undefined {\n\tif (!payload) return undefined\n\tif (!(QDRANT_LOGICAL_ID_KEY in payload)) return payload\n\tconst next: Record<string, string | number | boolean | null> = {}\n\tfor (const [key, value] of Object.entries(payload)) {\n\t\tif (key === QDRANT_LOGICAL_ID_KEY) continue\n\t\tnext[key] = value\n\t}\n\treturn Object.keys(next).length > 0 ? next : undefined\n}\n","/**\n * Qdrant REST vendor client.\n * Host: `new QdrantClient(auth)`. Agent tools: `fromContext(ctx)`.\n * @see https://api.qdrant.tech/api-reference\n */\n\nimport { isNumber, isPlainObject } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport {\n\tmapVectorHttpStatus,\n\tmergeQdrantFilter,\n\tparseMetadata,\n\tparseNumberArray,\n\tparsePointId,\n\tparseUpstreamMessage,\n\trequireCollection,\n\tstampDefaultFilterMetadata\n} from '../_vector/domain'\nimport type { VectorDefaultFilter } from '../_vector/domain'\nimport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQdrantAuth,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch\n} from './contracts'\nimport { qdrantAuthSchema } from './contracts'\nimport {\n\tisNativeQdrantId,\n\tQDRANT_LOGICAL_ID_KEY,\n\tresolveLogicalPointId,\n\tstripLogicalIdPayload,\n\ttoQdrantPointId\n} from './domain'\n\nexport type QdrantClientOptions = {\n\tfetch?: HttpServiceOptions['fetch'] | undefined\n\tsignal?: HttpServiceOptions['signal'] | undefined\n}\n\nexport class QdrantClient {\n\treadonly #http: HttpService\n\treadonly #defaultCollection: string | undefined\n\treadonly #defaultFilter: VectorDefaultFilter | undefined\n\n\tconstructor(auth: QdrantAuth, options: QdrantClientOptions = {}) {\n\t\tconst parsed = qdrantAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Qdrant 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.#defaultCollection = parsed.data.default_collection\n\t\tthis.#defaultFilter = parsed.data.default_filter\n\t\tconst headers: Record<string, string> = { 'Content-Type': 'application/json' }\n\t\tif (parsed.data.api_key) headers['api-key'] = parsed.data.api_key\n\t\tconst httpOptions: HttpServiceOptions = {\n\t\t\tbaseURL: parsed.data.base_url,\n\t\t\theaders,\n\t\t\tlabel: 'Qdrant'\n\t\t}\n\t\tif (options.fetch) httpOptions.fetch = options.fetch\n\t\tif (options.signal) httpOptions.signal = options.signal\n\t\tthis.#http = new HttpService(httpOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): QdrantClient {\n\t\tconst auth = requireAuth(ctx, qdrantAuthSchema)\n\t\tconst options: QdrantClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new QdrantClient(auth, options)\n\t}\n\n\tasync upsert(input: UpsertVectorsInput): Promise<UpsertVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant upsert')\n\t\tconst points = input.vectors.map((point) => {\n\t\t\tconst wireId = toQdrantPointId(point.id)\n\t\t\tconst stamped = stampDefaultFilterMetadata(point.metadata, this.#defaultFilter)\n\t\t\tconst payload: Record<string, string | number | boolean | null> = stamped ? { ...stamped } : {}\n\t\t\tif (!isNativeQdrantId(point.id)) {\n\t\t\t\tpayload[QDRANT_LOGICAL_ID_KEY] = point.id\n\t\t\t}\n\t\t\tconst row: Record<string, unknown> = { id: wireId, vector: point.values }\n\t\t\tif (Object.keys(payload).length > 0) row['payload'] = payload\n\t\t\treturn row\n\t\t})\n\t\tconst res = await this.#http.put(\n\t\t\t`/collections/${encodeURIComponent(collection)}/points`,\n\t\t\t{ points },\n\t\t\t{ label: 'Qdrant upsert', noThrow: true, query: { wait: 'true' } }\n\t\t)\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant upsert failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { upserted: input.vectors.length, collection }\n\t}\n\n\tasync query(input: QueryVectorsInput): Promise<QueryVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant query')\n\t\tconst topK = input.top_k ?? 8\n\t\tconst includeMetadata = input.include_metadata !== false\n\t\t// Always pull payload so free-form logical ids can be restored.\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvector: input.vector,\n\t\t\tlimit: topK,\n\t\t\twith_payload: true,\n\t\t\twith_vector: input.include_values === true\n\t\t}\n\t\tconst filter = mergeQdrantFilter(this.#defaultFilter, input.filter)\n\t\tif (filter) body['filter'] = filter\n\n\t\tconst res = await this.#http.post(`/collections/${encodeURIComponent(collection)}/points/search`, body, {\n\t\t\tlabel: 'Qdrant search',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant search failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\n\t\tconst result = isPlainObject(res.data) ? res.data['result'] : undefined\n\t\tconst rows = Array.isArray(result) ? result : []\n\t\tconst matches: VectorMatch[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (!isPlainObject(row)) continue\n\t\t\tconst wireId = parsePointId(row['id'])\n\t\t\tif (!wireId) continue\n\t\t\tconst rawPayload = isPlainObject(row['payload']) ? row['payload'] : undefined\n\t\t\tconst score = isNumber(row['score']) ? row['score'] : 0\n\t\t\tconst id = resolveLogicalPointId(wireId, rawPayload)\n\t\t\tconst match: VectorMatch = { id, score }\n\t\t\tif (includeMetadata) {\n\t\t\t\tconst meta = stripLogicalIdPayload(parseMetadata(row['payload']))\n\t\t\t\tif (meta) match.metadata = meta\n\t\t\t}\n\t\t\tif (input.include_values === true) {\n\t\t\t\tconst values = parseNumberArray(row['vector'])\n\t\t\t\tif (values) match.values = values\n\t\t\t}\n\t\t\tmatches.push(match)\n\t\t}\n\t\treturn { matches, collection }\n\t}\n\n\tasync delete(input: DeleteVectorsInput): Promise<DeleteVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant delete')\n\t\tconst points = input.ids.map((id) => toQdrantPointId(id))\n\t\tconst res = await this.#http.post(\n\t\t\t`/collections/${encodeURIComponent(collection)}/points/delete`,\n\t\t\t{ points },\n\t\t\t{ label: 'Qdrant delete', noThrow: true, query: { wait: 'true' } }\n\t\t)\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant delete failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { deleted: input.ids.length, collection }\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { QdrantClient } from './client'\nimport {\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqdrantAuthSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema\n} from './contracts'\n\nexport const qdrantUpsertTool = defineTool({\n\tid: 'qdrant-upsert',\n\tname: 'qdrantUpsert',\n\tdescription: 'Upsert points into a Qdrant collection. Omit collection only when a default collection is configured.',\n\tinputSchema: upsertVectorsInputSchema,\n\toutputSchema: upsertVectorsOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).upsert(input)\n})\n\nexport const qdrantQueryTool = defineTool({\n\tid: 'qdrant-query',\n\tname: 'qdrantQuery',\n\tdescription: 'Nearest-neighbor search in a Qdrant collection.',\n\tinputSchema: queryVectorsInputSchema,\n\toutputSchema: queryVectorsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).query(input)\n})\n\nexport const qdrantDeleteTool = defineTool({\n\tid: 'qdrant-delete',\n\tname: 'qdrantDelete',\n\tdescription: 'Delete points by id from a Qdrant collection.',\n\tinputSchema: deleteVectorsInputSchema,\n\toutputSchema: deleteVectorsOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).delete(input)\n})\n\nexport const qdrantModule = defineModule({\n\tid: 'qdrant',\n\ttitle: 'Qdrant',\n\tdescription: 'Qdrant vector database REST: upsert, query, and delete points in a collection.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: qdrantAuthSchema },\n\tcategories: ['ai', 'vector'],\n\tclassification: 'pii',\n\ttags: ['qdrant'],\n\ttools: [qdrantUpsertTool, qdrantQueryTool, qdrantDeleteTool]\n})\n"],"mappings":";;;;;;;;;AA8BA,MAAa,mBAAmB,EAAE,OAAO;CACxC,UAAU,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CACL,SAAS,sFAAsF;CACjG,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,yBAAyB;CACxE,oBAAoB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,0DAA0D;CACpH,gBAAgB,0BACd,SAAS,CAAC,CACV,SACA,qHACD;AACF,CAAC;;;;;;;;AChCD,MAAa,wBAAwB;AAErC,MAAM,UAAU;AAChB,MAAM,UAAU;;AAGhB,SAAgB,WAAW,OAAuB;CACjD,MAAM,QAAQ,WAAW,KAAK,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC;CACzF,MAAM,cAAc,MAAM,GAAG,CAAC;CAC9B,MAAM,cAAc,MAAM,GAAG,CAAC;CAC9B,IAAI,gBAAgB,KAAA,KAAa,gBAAgB,KAAA,GAChD,MAAM,IAAI,MAAM,sCAAsC;CAEvD,MAAM,KAAM,cAAc,KAAQ;CAClC,MAAM,KAAM,cAAc,KAAQ;CAClC,MAAM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AAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AAC1E,CAAC;AAED,MAAa,kBAAkB,WAAW;CACzC,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,MAAM,KAAK;AACzE,CAAC;AAED,MAAa,mBAAmB,WAAW;CAC1C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AAC1E,CAAC;AAED,MAAa,eAAe,aAAa;CACxC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAiB;CACjD,YAAY,CAAC,MAAM,QAAQ;CAC3B,gBAAgB;CAChB,MAAM,CAAC,QAAQ;CACf,OAAO;EAAC;EAAkB;EAAiB;CAAgB;AAC5D,CAAC"}
1
+ {"version":3,"file":"qdrant-DhnitNEu.js","names":["#http","#defaultCollection","#defaultFilter"],"sources":["../src/vendors/qdrant/contracts.ts","../src/vendors/qdrant/domain.ts","../src/vendors/qdrant/client.ts","../src/vendors/qdrant/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { vectorDefaultFilterSchema } from '../_vector'\n\nexport {\n\tMAX_TOP_K,\n\tMAX_VECTOR_BATCH,\n\tMAX_VECTOR_DIMENSIONS,\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema,\n\tvectorMatchSchema,\n\tvectorMetadataSchema,\n\tvectorPointSchema\n} from '../_vector'\nexport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch,\n\tVectorMetadata,\n\tVectorPoint\n} from '../_vector'\n\nexport const qdrantAuthSchema = z.object({\n\tbase_url: z\n\t\t.string()\n\t\t.url()\n\t\t.describe('Qdrant HTTP origin, for example http://127.0.0.1:6333 or https://xxx.cloud.qdrant.io'),\n\tapi_key: z.string().min(1).optional().describe('Optional Qdrant API key'),\n\tdefault_collection: z.string().min(1).optional().describe('Default collection name when tool input omits collection'),\n\tdefault_filter: vectorDefaultFilterSchema\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Host-bound filter always applied on query (flat equality or native Qdrant must/should); flat keys stamped on upsert'\n\t\t)\n})\n\nexport type QdrantAuth = z.infer<typeof qdrantAuthSchema>\n","/**\n * Qdrant point-id helpers. Qdrant only accepts unsigned integers or UUIDs;\n * free-form string ids (e.g. RAG `doc#0`) are mapped to a deterministic UUID\n * and the original id is stored under `__logical_id` in the payload.\n */\n\nimport { createHash } from 'node:crypto'\n\nimport { isString } from 'es-toolkit'\n\nexport const QDRANT_LOGICAL_ID_KEY = '__logical_id'\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\nconst UINT_RE = /^(0|[1-9]\\d*)$/\n\n/** Deterministic UUID (SHA-256 → RFC-like layout) for free-form logical ids. */\nexport function hashToUuid(value: string): string {\n\tconst bytes = Uint8Array.from(createHash('sha256').update(value).digest().subarray(0, 16))\n\tconst versionByte = bytes.at(6)\n\tconst variantByte = bytes.at(8)\n\tif (versionByte === undefined || variantByte === undefined) {\n\t\tthrow new Error('SHA-256 digest shorter than 16 bytes')\n\t}\n\tbytes[6] = (versionByte & 0x0f) | 0x50\n\tbytes[8] = (variantByte & 0x3f) | 0x80\n\tconst hex = Buffer.from(bytes).toString('hex')\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`\n}\n\n/** Map package logical point id → Qdrant wire id. */\nexport function toQdrantPointId(logicalId: string): string | number {\n\tif (UINT_RE.test(logicalId)) {\n\t\tconst n = Number(logicalId)\n\t\tif (Number.isSafeInteger(n) && n >= 0) return n\n\t}\n\tif (UUID_RE.test(logicalId)) return logicalId.toLowerCase()\n\treturn hashToUuid(logicalId)\n}\n\nexport function isNativeQdrantId(logicalId: string): boolean {\n\tif (UINT_RE.test(logicalId)) {\n\t\tconst n = Number(logicalId)\n\t\treturn Number.isSafeInteger(n) && n >= 0\n\t}\n\treturn UUID_RE.test(logicalId)\n}\n\n/** Prefer payload `__logical_id` when present so free-form ids round-trip. */\nexport function resolveLogicalPointId(wireId: string, payload: Record<string, unknown> | undefined): string {\n\tconst logical = payload?.[QDRANT_LOGICAL_ID_KEY]\n\tif (isString(logical) && logical.length > 0) return logical\n\treturn wireId\n}\n\nexport function stripLogicalIdPayload(\n\tpayload: Record<string, string | number | boolean | null> | undefined\n): Record<string, string | number | boolean | null> | undefined {\n\tif (!payload) return undefined\n\tif (!(QDRANT_LOGICAL_ID_KEY in payload)) return payload\n\tconst next: Record<string, string | number | boolean | null> = {}\n\tfor (const [key, value] of Object.entries(payload)) {\n\t\tif (key === QDRANT_LOGICAL_ID_KEY) continue\n\t\tnext[key] = value\n\t}\n\treturn Object.keys(next).length > 0 ? next : undefined\n}\n","/**\n * Qdrant REST vendor client.\n * Host: `new QdrantClient(auth)`. Agent tools: `fromContext(ctx)`.\n * @see https://api.qdrant.tech/api-reference\n */\n\nimport { isNumber, isPlainObject } from 'es-toolkit'\n\nimport { ToolError } from '../../core/errors'\nimport { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport { HttpService } from '../../transport/http-service'\nimport type { HttpServiceOptions } from '../../transport/http-service'\nimport {\n\tmapVectorHttpStatus,\n\tmergeQdrantFilter,\n\tparseMetadata,\n\tparseNumberArray,\n\tparsePointId,\n\tparseUpstreamMessage,\n\trequireCollection,\n\tstampDefaultFilterMetadata\n} from '../_vector/domain'\nimport type { VectorDefaultFilter } from '../_vector/domain'\nimport type {\n\tDeleteVectorsInput,\n\tDeleteVectorsOutput,\n\tQdrantAuth,\n\tQueryVectorsInput,\n\tQueryVectorsOutput,\n\tUpsertVectorsInput,\n\tUpsertVectorsOutput,\n\tVectorMatch\n} from './contracts'\nimport { qdrantAuthSchema } from './contracts'\nimport {\n\tisNativeQdrantId,\n\tQDRANT_LOGICAL_ID_KEY,\n\tresolveLogicalPointId,\n\tstripLogicalIdPayload,\n\ttoQdrantPointId\n} from './domain'\n\nexport type QdrantClientOptions = {\n\tfetch?: HttpServiceOptions['fetch'] | undefined\n\tsignal?: HttpServiceOptions['signal'] | undefined\n}\n\nexport class QdrantClient {\n\treadonly #http: HttpService\n\treadonly #defaultCollection: string | undefined\n\treadonly #defaultFilter: VectorDefaultFilter | undefined\n\n\tconstructor(auth: QdrantAuth, options: QdrantClientOptions = {}) {\n\t\tconst parsed = qdrantAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid Qdrant 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.#defaultCollection = parsed.data.default_collection\n\t\tthis.#defaultFilter = parsed.data.default_filter\n\t\tconst headers: Record<string, string> = { 'Content-Type': 'application/json' }\n\t\tif (parsed.data.api_key) headers['api-key'] = parsed.data.api_key\n\t\tconst httpOptions: HttpServiceOptions = {\n\t\t\tbaseURL: parsed.data.base_url,\n\t\t\theaders,\n\t\t\tlabel: 'Qdrant'\n\t\t}\n\t\tif (options.fetch) httpOptions.fetch = options.fetch\n\t\tif (options.signal) httpOptions.signal = options.signal\n\t\tthis.#http = new HttpService(httpOptions)\n\t}\n\n\tstatic fromContext(ctx: ToolContext): QdrantClient {\n\t\tconst auth = requireAuth(ctx, qdrantAuthSchema)\n\t\tconst options: QdrantClientOptions = {}\n\t\tif (ctx.fetch) options.fetch = ctx.fetch\n\t\tif (ctx.signal) options.signal = ctx.signal\n\t\treturn new QdrantClient(auth, options)\n\t}\n\n\tasync upsert(input: UpsertVectorsInput): Promise<UpsertVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant upsert')\n\t\tconst points = input.vectors.map((point) => {\n\t\t\tconst wireId = toQdrantPointId(point.id)\n\t\t\tconst stamped = stampDefaultFilterMetadata(point.metadata, this.#defaultFilter)\n\t\t\tconst payload: Record<string, string | number | boolean | null> = stamped ? { ...stamped } : {}\n\t\t\tif (!isNativeQdrantId(point.id)) {\n\t\t\t\tpayload[QDRANT_LOGICAL_ID_KEY] = point.id\n\t\t\t}\n\t\t\tconst row: Record<string, unknown> = { id: wireId, vector: point.values }\n\t\t\tif (Object.keys(payload).length > 0) row['payload'] = payload\n\t\t\treturn row\n\t\t})\n\t\tconst res = await this.#http.put(\n\t\t\t`/collections/${encodeURIComponent(collection)}/points`,\n\t\t\t{ points },\n\t\t\t{ label: 'Qdrant upsert', noThrow: true, query: { wait: 'true' } }\n\t\t)\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant upsert failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { upserted: input.vectors.length, collection }\n\t}\n\n\tasync query(input: QueryVectorsInput): Promise<QueryVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant query')\n\t\tconst topK = input.top_k ?? 8\n\t\tconst includeMetadata = input.include_metadata !== false\n\t\t// Always pull payload so free-form logical ids can be restored.\n\t\tconst body: Record<string, unknown> = {\n\t\t\tvector: input.vector,\n\t\t\tlimit: topK,\n\t\t\twith_payload: true,\n\t\t\twith_vector: input.include_values === true\n\t\t}\n\t\tconst filter = mergeQdrantFilter(this.#defaultFilter, input.filter)\n\t\tif (filter) body['filter'] = filter\n\n\t\tconst res = await this.#http.post(`/collections/${encodeURIComponent(collection)}/points/search`, body, {\n\t\t\tlabel: 'Qdrant search',\n\t\t\tnoThrow: true\n\t\t})\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant search failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\n\t\tconst result = isPlainObject(res.data) ? res.data['result'] : undefined\n\t\tconst rows = Array.isArray(result) ? result : []\n\t\tconst matches: VectorMatch[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (!isPlainObject(row)) continue\n\t\t\tconst wireId = parsePointId(row['id'])\n\t\t\tif (!wireId) continue\n\t\t\tconst rawPayload = isPlainObject(row['payload']) ? row['payload'] : undefined\n\t\t\tconst score = isNumber(row['score']) ? row['score'] : 0\n\t\t\tconst id = resolveLogicalPointId(wireId, rawPayload)\n\t\t\tconst match: VectorMatch = { id, score }\n\t\t\tif (includeMetadata) {\n\t\t\t\tconst meta = stripLogicalIdPayload(parseMetadata(row['payload']))\n\t\t\t\tif (meta) match.metadata = meta\n\t\t\t}\n\t\t\tif (input.include_values === true) {\n\t\t\t\tconst values = parseNumberArray(row['vector'])\n\t\t\t\tif (values) match.values = values\n\t\t\t}\n\t\t\tmatches.push(match)\n\t\t}\n\t\treturn { matches, collection }\n\t}\n\n\tasync delete(input: DeleteVectorsInput): Promise<DeleteVectorsOutput> {\n\t\tconst collection = requireCollection(input.collection, this.#defaultCollection, 'Qdrant delete')\n\t\tconst points = input.ids.map((id) => toQdrantPointId(id))\n\t\tconst res = await this.#http.post(\n\t\t\t`/collections/${encodeURIComponent(collection)}/points/delete`,\n\t\t\t{ points },\n\t\t\t{ label: 'Qdrant delete', noThrow: true, query: { wait: 'true' } }\n\t\t)\n\t\tif (!res.ok) {\n\t\t\tthrow new ToolError(parseUpstreamMessage(res.data, `Qdrant delete failed with HTTP ${res.status}`), {\n\t\t\t\tcode: mapVectorHttpStatus(res.status),\n\t\t\t\tdetails: { status: res.status }\n\t\t\t})\n\t\t}\n\t\treturn { deleted: input.ids.length, collection }\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { QdrantClient } from './client'\nimport {\n\tdeleteVectorsInputSchema,\n\tdeleteVectorsOutputSchema,\n\tqdrantAuthSchema,\n\tqueryVectorsInputSchema,\n\tqueryVectorsOutputSchema,\n\tupsertVectorsInputSchema,\n\tupsertVectorsOutputSchema\n} from './contracts'\n\nexport const qdrantUpsertTool = defineTool({\n\tid: 'qdrant-upsert',\n\tname: 'qdrantUpsert',\n\tdescription: 'Upsert points into a Qdrant collection. Omit collection only when a default collection is configured.',\n\tinputSchema: upsertVectorsInputSchema,\n\toutputSchema: upsertVectorsOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).upsert(input)\n})\n\nexport const qdrantQueryTool = defineTool({\n\tid: 'qdrant-query',\n\tname: 'qdrantQuery',\n\tdescription: 'Nearest-neighbor search in a Qdrant collection.',\n\tinputSchema: queryVectorsInputSchema,\n\toutputSchema: queryVectorsOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).query(input)\n})\n\nexport const qdrantDeleteTool = defineTool({\n\tid: 'qdrant-delete',\n\tname: 'qdrantDelete',\n\tdescription: 'Delete points by id from a Qdrant collection.',\n\tinputSchema: deleteVectorsInputSchema,\n\toutputSchema: deleteVectorsOutputSchema,\n\tsideEffect: 'delete',\n\truntime: 'both',\n\texecute: async (input, ctx) => QdrantClient.fromContext(ctx).delete(input)\n})\n\nexport const qdrantModule = defineModule({\n\tid: 'qdrant',\n\ttitle: 'Qdrant',\n\tdescription: 'Qdrant vector database REST: upsert, query, and delete points in a collection.',\n\truntime: 'both',\n\tauth: { type: 'custom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CAC1C,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,SAAS,OAAO,OAAO,QAAQ,aAAa,YAAY,GAAG,CAAC,CAAC,OAAO,KAAK;AAC1E,CAAC;AAED,MAAa,eAAe,aAAa;CACxC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAiB;CACjD,YAAY,CAAC,MAAM,QAAQ;CAC3B,gBAAgB;CAChB,MAAM,CAAC,QAAQ;CACf,OAAO;EAAC;EAAkB;EAAiB;CAAgB;AAC5D,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-DdFALdNf.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CbQI8dAN.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 { n as runBatchItems, t as batchResultSchema } from "./batch-Co1ujeAW.js";
@@ -152,4 +152,4 @@ const resendModule = defineModule({
152
152
  //#endregion
153
153
  export { resendAuthSchema as a, resendSendInputSchema as c, ResendClient as i, resendSendOutputSchema as l, resendSendBatchTool as n, resendSendBatchInputSchema as o, resendSendTool as r, resendSendBatchOutputSchema as s, resendModule as t };
154
154
 
155
- //# sourceMappingURL=resend-Cfgm4HuV.js.map
155
+ //# sourceMappingURL=resend-BBrjcYvB.js.map
@@ -1 +1 @@
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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AAiB;CACjD,YAAY,CAAC,OAAO;CACpB,gBAAgB;CAChB,MAAM,CAAC,MAAM;CACb,OAAO,CAAC,gBAAgB,mBAAmB;AAC5C,CAAC"}
1
+ {"version":3,"file":"resend-BBrjcYvB.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,CAAC,SAAS,gCAAgC;CAC9F,aAAa,EACX,MAAM,gBAAgB,CAAC,CACvB,I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Z,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-DdFALdNf.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CbQI8dAN.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";
@@ -426,6 +426,10 @@ function tooLarge(maxBytes, contentLength, message, cause) {
426
426
  function assertByteLimit(maxBytes) {
427
427
  if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new ToolError("Download limit must be a non-negative safe integer", { code: "bad_input" });
428
428
  }
429
+ function strongEtagCondition(etag) {
430
+ if (!etag || etag.startsWith("W/")) return void 0;
431
+ return `"${etag}"`;
432
+ }
429
433
  var S3Client = class S3Client {
430
434
  #auth;
431
435
  #aws;
@@ -510,7 +514,7 @@ var S3Client = class S3Client {
510
514
  return out;
511
515
  }
512
516
  /** HEAD size gate plus a bounded Range GET (wire key only). */
513
- async #getBoundedWire(wireKey, maxBytes, limitMessage) {
517
+ async #getBoundedWire(wireKey, maxBytes, limitMessage, retryOnPreconditionFailure = true) {
514
518
  assertByteLimit(maxBytes);
515
519
  const head = await this.#headWire(wireKey);
516
520
  if (!head.exists) objectNotFound();
@@ -526,7 +530,8 @@ var S3Client = class S3Client {
526
530
  };
527
531
  }
528
532
  const headers = { Range: `bytes=0-${maxBytes}` };
529
- if (head.etag) headers["If-Match"] = head.etag.startsWith("\"") ? head.etag : `"${head.etag}"`;
533
+ const ifMatch = strongEtagCondition(head.etag);
534
+ if (ifMatch) headers["If-Match"] = ifMatch;
530
535
  let response;
531
536
  try {
532
537
  response = await this.#aws.bytes("GET", objectUrl(this.#auth, wireKey), {
@@ -539,14 +544,17 @@ var S3Client = class S3Client {
539
544
  const observed = error.details?.["content_length"];
540
545
  tooLarge(maxBytes, isNumber(observed) && Number.isFinite(observed) ? observed : maxBytes + 1, limitMessage, error);
541
546
  }
542
- if (isToolError(error) && error.details?.["status"] === 412) throw new ToolError("Object changed during download", {
543
- code: "upstream",
544
- details: {
545
- status: 412,
546
- key: this.#publicKey(wireKey)
547
- },
548
- cause: error
549
- });
547
+ if (isToolError(error) && error.details?.["status"] === 412) {
548
+ if (retryOnPreconditionFailure) return this.#getBoundedWire(wireKey, maxBytes, limitMessage, false);
549
+ throw new ToolError("Object changed during download", {
550
+ code: "upstream",
551
+ details: {
552
+ status: 412,
553
+ key: this.#publicKey(wireKey)
554
+ },
555
+ cause: error
556
+ });
557
+ }
550
558
  remapNotFound(error);
551
559
  }
552
560
  const total = contentRangeTotal(response.headers.get("content-range"));
@@ -760,6 +768,9 @@ var S3Client = class S3Client {
760
768
  const requestedBytes = range.end_byte - range.start_byte + 1;
761
769
  if (!Number.isSafeInteger(range.start_byte) || !Number.isSafeInteger(range.end_byte) || range.start_byte < 0 || requestedBytes < 1) throw new ToolError("Byte range must use non-negative inclusive offsets with end_byte >= start_byte", { code: "bad_input" });
762
770
  if (requestedBytes > 5242880) tooLarge(MAX_OBJECT_BYTES, requestedBytes, "Byte range exceeds download limit");
771
+ return this.#getBytesRangeWire(wireKey, range, requestedBytes);
772
+ }
773
+ async #getBytesRangeWire(wireKey, range, requestedBytes, retryOnPreconditionFailure = true) {
763
774
  const head = await this.#headWire(wireKey);
764
775
  if (!head.exists) objectNotFound();
765
776
  if (head.content_length !== void 0 && range.start_byte >= head.content_length) throw new ToolError("Byte range starts beyond the end of the object", {
@@ -770,7 +781,8 @@ var S3Client = class S3Client {
770
781
  }
771
782
  });
772
783
  const headers = { Range: `bytes=${range.start_byte}-${range.end_byte}` };
773
- if (head.etag) headers["If-Match"] = head.etag.startsWith("\"") ? head.etag : `"${head.etag}"`;
784
+ const ifMatch = strongEtagCondition(head.etag);
785
+ if (ifMatch) headers["If-Match"] = ifMatch;
774
786
  let response;
775
787
  try {
776
788
  response = await this.#aws.bytes("GET", objectUrl(this.#auth, wireKey), {
@@ -779,14 +791,17 @@ var S3Client = class S3Client {
779
791
  maxBytes: requestedBytes
780
792
  });
781
793
  } catch (error) {
782
- if (isToolError(error) && error.details?.["status"] === 412) throw new ToolError("Object changed during download", {
783
- code: "upstream",
784
- details: {
785
- status: 412,
786
- key: this.#publicKey(wireKey)
787
- },
788
- cause: error
789
- });
794
+ if (isToolError(error) && error.details?.["status"] === 412) {
795
+ if (retryOnPreconditionFailure) return this.#getBytesRangeWire(wireKey, range, requestedBytes, false);
796
+ throw new ToolError("Object changed during download", {
797
+ code: "upstream",
798
+ details: {
799
+ status: 412,
800
+ key: this.#publicKey(wireKey)
801
+ },
802
+ cause: error
803
+ });
804
+ }
790
805
  remapNotFound(error);
791
806
  }
792
807
  const out = {
@@ -952,4 +967,4 @@ const s3Module = defineModule({
952
967
  //#endregion
953
968
  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
969
 
955
- //# sourceMappingURL=s3-TKCIZZ2q.js.map
970
+ //# sourceMappingURL=s3-BpivS7pv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3-BpivS7pv.js","names":["#auth","#aws","#keyPrefix","#resolve","#getBoundedWire","#headWire","#publicKey","#resolveCopySourceKey","#getBytesRangeWire"],"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\nfunction strongEtagCondition(etag: string | undefined): string | undefined {\n\tif (!etag || etag.startsWith('W/')) return undefined\n\treturn `\"${etag}\"`\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\tretryOnPreconditionFailure = true\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\tconst ifMatch = strongEtagCondition(head.etag)\n\t\tif (ifMatch) headers['If-Match'] = ifMatch\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\tif (retryOnPreconditionFailure) {\n\t\t\t\t\treturn this.#getBoundedWire(wireKey, maxBytes, limitMessage, false)\n\t\t\t\t}\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\treturn this.#getBytesRangeWire(wireKey, range, requestedBytes)\n\t}\n\n\tasync #getBytesRangeWire(\n\t\twireKey: string,\n\t\trange: S3ByteRange,\n\t\trequestedBytes: number,\n\t\tretryOnPreconditionFailure = true\n\t): Promise<S3ByteRangeResult> {\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\tconst ifMatch = strongEtagCondition(head.etag)\n\t\tif (ifMatch) headers['If-Match'] = ifMatch\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\tif (retryOnPreconditionFailure) {\n\t\t\t\t\treturn this.#getBytesRangeWire(wireKey, range, requestedBytes, false)\n\t\t\t\t}\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,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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-DdFALdNf.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CbQI8dAN.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-D6XzBS3b.js.map
1455
+ //# sourceMappingURL=slack-D9OmRfO9.js.map