@5ss/ai-tools 3.5.1 → 3.6.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@5ss/ai-tools` are documented here.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Releases are cut by [semantic-release](https://semantic-release.gitbook.io/) from [conventional commits](https://www.conventionalcommits.org/).
6
6
 
7
+ ## [3.6.0](https://github.com/five-star-solutions-co/ai-tools/compare/v3.5.1...v3.6.0) (2026-08-28)
8
+
9
+ ### Features
10
+
11
+ * **core:** add shipment functionality ([beb0d84](https://github.com/five-star-solutions-co/ai-tools/commit/beb0d84898c786380b56ac83c5f0d8d1d1d1178e))
12
+
7
13
  ## [3.5.1](https://github.com/five-star-solutions-co/ai-tools/compare/v3.5.0...v3.5.1) (2026-08-27)
8
14
 
9
15
  ## [3.5.0](https://github.com/five-star-solutions-co/ai-tools/compare/v3.4.0...v3.5.0) (2026-08-27)
@@ -135,6 +141,10 @@ Public surfaces removed or renamed since **v1.6.1** — next release **must** be
135
141
  | `mergeToolContext` / adapter `createContext` | Explicit `undefined` fields **do not** erase base `signal` / `fetch` / `auth` / `now` |
136
142
  | MCP `context` | Still accepts static `ToolContext` **or** factory `() => ToolContext \| Promise<…>` (and deprecated `contextFactory`) |
137
143
 
144
+ ### Added
145
+
146
+ - ShipStation V2 vendor pack with API-key auth and paginated label and shipment read tools.
147
+
138
148
  ### Notes (compat preserved)
139
149
 
140
150
  - Adapter `createContext` callbacks use the installed framework execution-context types.
package/README.md CHANGED
@@ -161,6 +161,7 @@ defineTool / defineModule
161
161
  | `@5ss/ai-tools/woocommerce` | orders, notes, refunds, products, variations, customers, coupons, categories | [woocommerce](./docs/vendors/woocommerce.md) |
162
162
  | `@5ss/ai-tools/katana` | sales/purchase/manufacturing orders, products, materials, customers, suppliers, inventory | [katana](./docs/vendors/katana.md) |
163
163
  | `@5ss/ai-tools/amazon-sp-api` | orders + items, FBA inventory, reports + documents, catalog search | [amazon-sp-api](./docs/vendors/amazon-sp-api.md) |
164
+ | `@5ss/ai-tools/shipstation` | paginated labels and shipments | [shipstation](./docs/vendors/shipstation.md) |
164
165
 
165
166
  Auth fields are **snake_case** (`api_key`, `bot_token`, `access_key_id`, …).
166
167
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/core/bind.ts","../../src/generated/module-keys.ts","../../src/core/contracts.ts","../../src/core/catalog.ts"],"sourcesContent":["/**\n * Per-invocation auth/context bind for multi-tenant hosts.\n */\n\nimport { mergeToolContext } from './context'\nimport type { ToolSelection } from './filter-tools'\nimport { filterModuleTools } from './filter-tools'\nimport type { ToolHooks } from './hooks'\nimport { ToolError } from './errors'\nimport type { AuthDefinition, ModuleDefinition, ToolContext, ToolDefinition, ToolExecution } from './types'\n\nfunction assertAuth<TAuth>(auth: AuthDefinition<TAuth>, value: unknown): TAuth | undefined {\n\tif (auth.type === 'none') {\n\t\tif (value !== undefined) throw new ToolError('This tool does not accept auth', { code: 'bad_auth' })\n\t\treturn undefined\n\t}\n\tconst parsed = auth.schema.safeParse(value)\n\tif (!parsed.success) {\n\t\tthrow new ToolError('Invalid auth credentials', {\n\t\t\tcode: 'bad_auth',\n\t\t\tdetails: { issues: parsed.error.issues.map((i) => i.message) }\n\t\t})\n\t}\n\treturn parsed.data\n}\n\nexport type BindModuleOptions<TAuth = unknown> = {\n\tresolveAuth?: (ctx: ToolContext) => TAuth | Promise<TAuth>\n\tresolveContext?: (ctx: ToolContext) => ToolContext | Promise<ToolContext>\n\thooks?: ToolHooks\n\t/**\n\t * Restrict the tool surface after bind.\n\t * Prefer composable `onlyTools` / `exceptTools` when filtering outside bind.\n\t */\n\ttools?: ToolSelection\n}\n\nasync function resolveBoundContext<TAuth>(\n\tmoduleAuth: AuthDefinition<TAuth>,\n\tincoming: ToolContext,\n\toptions: BindModuleOptions<TAuth>\n): Promise<ToolContext> {\n\tconst base = options.resolveContext\n\t\t? mergeToolContext(incoming, await options.resolveContext(incoming))\n\t\t: { ...incoming }\n\tif (moduleAuth.type === 'none') return base\n\tif (!options.resolveAuth) {\n\t\tthrow new ToolError('resolveAuth is required for modules that declare auth', { code: 'bad_auth' })\n\t}\n\tconst auth = assertAuth(moduleAuth, await options.resolveAuth(base))\n\treturn {\n\t\t...base,\n\t\t...(auth !== undefined && { auth })\n\t}\n}\n\nexport function bindTool<TInput, TOutput, TAuth = unknown>(\n\ttool: ToolDefinition<TInput, TOutput>,\n\tmoduleAuth: AuthDefinition<TAuth>,\n\toptions: BindModuleOptions<TAuth>\n): ToolDefinition<TInput, TOutput> {\n\tconst previous = tool.execution ?? { run: tool.execute }\n\tconst bindContext = async (ctx: ToolContext): Promise<ToolContext> => {\n\t\tconst base = previous.bindContext ? await previous.bindContext(ctx) : ctx\n\t\treturn resolveBoundContext(moduleAuth, base, options)\n\t}\n\tconst execution: ToolExecution = {\n\t\t...previous,\n\t\tbindContext,\n\t\t...(options.hooks && { hooks: options.hooks })\n\t}\n\treturn {\n\t\t...tool,\n\t\texecution,\n\t\texecute: async (input, ctx) => execution.run(input, await bindContext(ctx))\n\t}\n}\n\nexport function bindModule<TAuth>(\n\tmodule: ModuleDefinition<TAuth>,\n\toptions: BindModuleOptions<TAuth>\n): ModuleDefinition<TAuth> {\n\tif (module.auth.type !== 'none' && !options.resolveAuth) {\n\t\tthrow new ToolError(`Module ${module.id} requires resolveAuth`, { code: 'bad_auth' })\n\t}\n\tconst scoped = options.tools !== undefined ? filterModuleTools(module, options.tools) : module\n\treturn {\n\t\t...scoped,\n\t\ttools: scoped.tools.map((tool) => bindTool(tool, scoped.auth, options))\n\t}\n}\n","// AUTO-GENERATED by `bun run codegen`. Do not edit by hand.\n/** Flat public export keys under src/{modules,vendors}. */\nexport const moduleKeys = [\n\t'amazon-sp-api',\n\t'artifacts',\n\t'bedrock-agentcore-browser',\n\t'bedrock-agentcore-code-interpreter',\n\t'browser',\n\t'calendar',\n\t'cloudflare-browser',\n\t'cloudflare-email',\n\t'cloudflare-sandbox',\n\t'code-sandbox',\n\t'content-type',\n\t'crypto',\n\t'document-extract',\n\t'document-render',\n\t'email',\n\t'email-message',\n\t'eventbridge-scheduler',\n\t'files',\n\t'image',\n\t'imessage',\n\t'katana',\n\t'mastra-vector',\n\t'messaging',\n\t'pinecone',\n\t'qdrant',\n\t'queue',\n\t'rag',\n\t'resend',\n\t's3',\n\t'scheduler',\n\t'skills',\n\t'slack',\n\t'sqs',\n\t'supabase-vector',\n\t'tasks',\n\t'teams',\n\t'telegram',\n\t'textract',\n\t'vector-store',\n\t'web-fetch',\n\t'woocommerce'\n] as const\n\nexport type ModuleKey = (typeof moduleKeys)[number]\n\n/** Capability seams under src/modules (brand-neutral model copy). */\nexport const moduleSeamKeys = [\n\t'artifacts',\n\t'browser',\n\t'calendar',\n\t'code-sandbox',\n\t'content-type',\n\t'crypto',\n\t'document-extract',\n\t'document-render',\n\t'email',\n\t'email-message',\n\t'files',\n\t'image',\n\t'messaging',\n\t'queue',\n\t'rag',\n\t'scheduler',\n\t'skills',\n\t'tasks',\n\t'vector-store',\n\t'web-fetch'\n] as const\n\nexport type ModuleSeamKey = (typeof moduleSeamKeys)[number]\n","import { flatMap, isPlainObject, isString } from 'es-toolkit'\nimport { isArray } from 'es-toolkit/compat'\nimport { toJSONSchema } from 'zod'\n\nimport { moduleSeamKeys } from '../generated/module-keys'\nimport type { ModuleDefinition, ToolDefinition } from './types'\nimport { duplicatesBy } from './unique'\n\nconst FORBIDDEN_MODEL_COPY =\n\t/\\b(api[_ ]?key|apiKey|bearer token|process\\.env|vault|secret key|authorization header|withAuth)\\b/i\n\n/**\n * Brand / vendor product names banned on **capability seam** model-facing copy\n * (module + tool description and input .describe()). Vendors may name their product.\n * Keep list brand-focused; avoid bare words like \"teams\" that appear in normal English.\n */\nconst FORBIDDEN_SEAM_BRAND_COPY =\n\t/\\b(Telegram|Slack|iMessage|Resend|Cloudflare|Textract|Pinecone|Qdrant|Supabase|WooCommerce|Katana|Amazon|Bot Framework|Microsoft Teams|Photon|Spectrum|Mastra|PgVector|OpenAI)\\b|\\bS3\\b|\\bR2\\b/\n\n/** Seam module ids from codegen (`src/modules/*` only — not hand-maintained). */\nconst SEAM_MODULE_IDS = new Set<string>(moduleSeamKeys)\n\nconst KEBAB_ID = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/\n\nexport type ContractIssue = {\n\tcode:\n\t\t| 'duplicate_tool_id'\n\t\t| 'empty_description'\n\t\t| 'empty_field_description'\n\t\t| 'forbidden_model_copy'\n\t\t| 'invalid_tool_id'\n\t\t| 'missing_name'\n\tmessage: string\n\tpath: string\n}\n\nexport type ContractResult = {\n\tok: boolean\n\tissues: ContractIssue[]\n}\n\nexport type CheckModelCopyOptions = {\n\t/** When true, also ban vendor brand names (capability seams). */\n\tseam?: boolean\n}\n\nfunction issue(path: string, code: ContractIssue['code'], message: string): ContractIssue {\n\treturn { path, code, message }\n}\n\nfunction checkModelCopy(\n\tpath: string,\n\ttext: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions = {}\n): void {\n\tconst trimmed = text.trim()\n\tif (!trimmed) {\n\t\tissues.push(issue(path, 'empty_description', 'Model-facing description is empty'))\n\t\treturn\n\t}\n\tif (FORBIDDEN_MODEL_COPY.test(trimmed)) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\tpath,\n\t\t\t\t'forbidden_model_copy',\n\t\t\t\t'Model-facing copy must not mention credentials, env vars, vaults, or host wiring'\n\t\t\t)\n\t\t)\n\t}\n\tif (options.seam && FORBIDDEN_SEAM_BRAND_COPY.test(trimmed)) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\tpath,\n\t\t\t\t'forbidden_model_copy',\n\t\t\t\t'Seam model-facing copy must not name vendors or products (use channel / bound store / provider-neutral language)'\n\t\t\t)\n\t\t)\n\t}\n}\n\nfunction fieldDescribes(\n\tschema: ToolDefinition['inputSchema'],\n\tpath: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions = {}\n): void {\n\tcheckFieldDescriptions(toJSONSchema(schema), `${path}.input`, issues, options)\n}\n\nfunction checkFieldDescriptions(\n\tschema: unknown,\n\tpath: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions\n): void {\n\tif (!isPlainObject(schema)) return\n\tconst properties = schema['properties']\n\tif (isPlainObject(properties)) {\n\t\tfor (const [key, value] of Object.entries(properties)) {\n\t\t\tif (!isPlainObject(value)) continue\n\t\t\tconst fieldPath = `${path}.${key}`\n\t\t\tconst description = value['description']\n\t\t\tif (!isString(description) || description.trim().length === 0) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(fieldPath, 'empty_field_description', `Input field \"${key}\" is missing a .describe() for the model`)\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tcheckModelCopy(fieldPath, description, issues, options)\n\t\t\t}\n\t\t\tcheckFieldDescriptions(value, fieldPath, issues, options)\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(schema)) {\n\t\tif (key === 'properties') continue\n\t\tif (isArray(value)) {\n\t\t\tfor (const [index, item] of value.entries()) {\n\t\t\t\tcheckFieldDescriptions(item, `${path}.${key}[${index}]`, issues, options)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcheckFieldDescriptions(value, `${path}.${key}`, issues, options)\n\t}\n}\n\nexport function validateTool(\n\ttool: ToolDefinition,\n\tpathPrefix = tool.id,\n\toptions: CheckModelCopyOptions = {}\n): ContractResult {\n\tconst issues: ContractIssue[] = []\n\n\tif (!tool.id.trim() || !KEBAB_ID.test(tool.id)) {\n\t\tissues.push(issue(`${pathPrefix}.id`, 'invalid_tool_id', `Tool id must be kebab-case (got \"${tool.id}\")`))\n\t}\n\tif (!tool.name.trim()) {\n\t\tissues.push(issue(`${pathPrefix}.name`, 'missing_name', 'Tool name is required'))\n\t}\n\tcheckModelCopy(`${pathPrefix}.description`, tool.description, issues, options)\n\tfieldDescribes(tool.inputSchema, pathPrefix, issues, options)\n\n\treturn { ok: issues.length === 0, issues }\n}\n\nexport function validateModule(module: ModuleDefinition): ContractResult {\n\tconst issues: ContractIssue[] = []\n\tconst seam = SEAM_MODULE_IDS.has(module.id)\n\tconst copyOpts: CheckModelCopyOptions = seam ? { seam: true } : {}\n\n\tcheckModelCopy(`module.${module.id}.description`, module.description, issues, copyOpts)\n\n\tfor (const id of duplicatesBy(module.tools, (tool) => tool.id)) {\n\t\tissues.push(issue(`module.${module.id}.tools.${id}`, 'duplicate_tool_id', `Duplicate tool id \"${id}\"`))\n\t}\n\n\tissues.push(\n\t\t...flatMap(module.tools, (tool) => validateTool(tool, `module.${module.id}.tools.${tool.id}`, copyOpts).issues)\n\t)\n\n\treturn { ok: issues.length === 0, issues }\n}\n\nexport function assertContracts(result: ContractResult, label = 'contract'): void {\n\tif (result.ok) return\n\tconst detail = result.issues.map((i) => `${i.path}: ${i.message}`).join('\\n')\n\tthrow new Error(`${label} failed:\\n${detail}`)\n}\n","import { toJSONSchema } from 'zod'\n\nimport type { AuthDefinition, ModuleDefinition, ToolDefinition } from './types'\n\nexport type ToolCatalogEntry = {\n\tdescription: string\n\tid: string\n\tinputJsonSchema: Record<string, unknown>\n\tname: string\n\toutputJsonSchema: Record<string, unknown>\n\truntime: ToolDefinition['meta']['runtime']\n\tsideEffect: ToolDefinition['meta']['sideEffect']\n\ttags: readonly string[]\n\tidempotent?: boolean | undefined\n\tlongRunning?: boolean | undefined\n\trequiresConfirmation?: boolean | undefined\n\tsupportsCancel?: boolean | undefined\n\tsupportsProgress?: boolean | undefined\n\tnetwork?: boolean | undefined\n\tartifacts?: boolean | undefined\n}\n\nexport type ModuleCatalogEntry = {\n\tauthType: AuthDefinition<unknown>['type']\n\tdescription: string\n\tid: string\n\truntime: ModuleDefinition['runtime']\n\ttitle: string\n\ttools: ToolCatalogEntry[]\n\t/** Inline SVG when the pack has a logo. */\n\tlogo?: string | undefined\n\tcategories: readonly string[]\n\tclassification?: ModuleDefinition['classification']\n\ttags: readonly string[]\n}\n\nexport function toToolCatalogEntry(tool: ToolDefinition): ToolCatalogEntry {\n\treturn {\n\t\tid: tool.id,\n\t\tname: tool.name,\n\t\tdescription: tool.description,\n\t\truntime: tool.meta.runtime,\n\t\tsideEffect: tool.meta.sideEffect,\n\t\ttags: tool.meta.tags ?? [],\n\t\tidempotent: tool.meta.idempotent,\n\t\tlongRunning: tool.meta.longRunning,\n\t\trequiresConfirmation: tool.meta.requiresConfirmation,\n\t\tsupportsCancel: tool.meta.supportsCancel,\n\t\tsupportsProgress: tool.meta.supportsProgress,\n\t\tnetwork: tool.meta.network,\n\t\tartifacts: tool.meta.artifacts,\n\t\tinputJsonSchema: toJSONSchema(tool.inputSchema),\n\t\toutputJsonSchema: toJSONSchema(tool.outputSchema)\n\t}\n}\n\nexport function toModuleCatalogEntry(module: ModuleDefinition): ModuleCatalogEntry {\n\treturn {\n\t\tid: module.id,\n\t\ttitle: module.title,\n\t\tdescription: module.description,\n\t\truntime: module.runtime,\n\t\tauthType: module.auth.type,\n\t\ttools: module.tools.map(toToolCatalogEntry),\n\t\tcategories: module.categories,\n\t\ttags: module.tags ?? [],\n\t\t...(module.classification !== undefined && { classification: module.classification }),\n\t\t...(module.logo !== undefined && { logo: module.logo })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,WAAkB,MAA6B,OAAmC;CAC1F,IAAI,KAAK,SAAS,QAAQ;EACzB,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,UAAU,kCAAkC,EAAE,MAAM,WAAW,CAAC;EACnG;CACD;CACA,MAAM,SAAS,KAAK,OAAO,UAAU,KAAK;CAC1C,IAAI,CAAC,OAAO,SACX,MAAM,IAAI,UAAU,4BAA4B;EAC/C,MAAM;EACN,SAAS,EAAE,QAAQ,OAAO,MAAM,OAAO,KAAK,MAAM,EAAE,OAAO,EAAE;CAC9D,CAAC;CAEF,OAAO,OAAO;AACf;AAaA,eAAe,oBACd,Y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MAAM,CAC/G;CAEA,OAAO;EAAE,IAAI,OAAO,WAAW;EAAG;CAAO;AAC1C;AAEA,SAAgB,gBAAgB,QAAwB,QAAQ,YAAkB;CACjF,IAAI,OAAO,IAAI;CACf,MAAM,SAAS,OAAO,OAAO,KAAK,MAAM,GAAG,EAAE,KAAK,IAAI,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI;CAC5E,MAAM,IAAI,MAAM,GAAG,MAAM,YAAY,QAAQ;AAC9C;;;ACnIA,SAAgB,mBAAmB,MAAwC;CAC1E,OAAO;EACN,IAAI,KAAK;EACT,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,SAAS,KAAK,KAAK;EACnB,YAAY,KAAK,KAAK;EACtB,MAAM,KAAK,KAAK,QAAQ,CAAC;EACzB,YAAY,KAAK,KAAK;EACtB,aAAa,KAAK,KAAK;EACvB,sBAAsB,KAAK,KAAK;EAChC,gBAAgB,KAAK,KAAK;EAC1B,kBAAkB,KAAK,KAAK;EAC5B,SAAS,KAAK,KAAK;EACnB,WAAW,KAAK,KAAK;EACrB,iBAAiB,aAAa,KAAK,WAAW;EAC9C,kBAAkB,aAAa,KAAK,YAAY;CACjD;AACD;AAEA,SAAgB,qBAAqB,QAA8C;CAClF,OAAO;EACN,IAAI,OAAO;EACX,OAAO,OAAO;EACd,aAAa,OAAO;EACpB,SAAS,OAAO;EAChB,UAAU,OAAO,KAAK;EACtB,OAAO,OAAO,MAAM,IAAI,kBAAkB;EAC1C,YAAY,OAAO;EACnB,MAAM,OAAO,QAAQ,CAAC;EACtB,GAAI,OAAO,mBAAmB,KAAA,KAAa,EAAE,gBAAgB,OAAO,eAAe;EACnF,GAAI,OAAO,SAAS,KAAA,KAAa,EAAE,MAAM,OAAO,KAAK;CACtD;AACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/core/bind.ts","../../src/generated/module-keys.ts","../../src/core/contracts.ts","../../src/core/catalog.ts"],"sourcesContent":["/**\n * Per-invocation auth/context bind for multi-tenant hosts.\n */\n\nimport { mergeToolContext } from './context'\nimport type { ToolSelection } from './filter-tools'\nimport { filterModuleTools } from './filter-tools'\nimport type { ToolHooks } from './hooks'\nimport { ToolError } from './errors'\nimport type { AuthDefinition, ModuleDefinition, ToolContext, ToolDefinition, ToolExecution } from './types'\n\nfunction assertAuth<TAuth>(auth: AuthDefinition<TAuth>, value: unknown): TAuth | undefined {\n\tif (auth.type === 'none') {\n\t\tif (value !== undefined) throw new ToolError('This tool does not accept auth', { code: 'bad_auth' })\n\t\treturn undefined\n\t}\n\tconst parsed = auth.schema.safeParse(value)\n\tif (!parsed.success) {\n\t\tthrow new ToolError('Invalid auth credentials', {\n\t\t\tcode: 'bad_auth',\n\t\t\tdetails: { issues: parsed.error.issues.map((i) => i.message) }\n\t\t})\n\t}\n\treturn parsed.data\n}\n\nexport type BindModuleOptions<TAuth = unknown> = {\n\tresolveAuth?: (ctx: ToolContext) => TAuth | Promise<TAuth>\n\tresolveContext?: (ctx: ToolContext) => ToolContext | Promise<ToolContext>\n\thooks?: ToolHooks\n\t/**\n\t * Restrict the tool surface after bind.\n\t * Prefer composable `onlyTools` / `exceptTools` when filtering outside bind.\n\t */\n\ttools?: ToolSelection\n}\n\nasync function resolveBoundContext<TAuth>(\n\tmoduleAuth: AuthDefinition<TAuth>,\n\tincoming: ToolContext,\n\toptions: BindModuleOptions<TAuth>\n): Promise<ToolContext> {\n\tconst base = options.resolveContext\n\t\t? mergeToolContext(incoming, await options.resolveContext(incoming))\n\t\t: { ...incoming }\n\tif (moduleAuth.type === 'none') return base\n\tif (!options.resolveAuth) {\n\t\tthrow new ToolError('resolveAuth is required for modules that declare auth', { code: 'bad_auth' })\n\t}\n\tconst auth = assertAuth(moduleAuth, await options.resolveAuth(base))\n\treturn {\n\t\t...base,\n\t\t...(auth !== undefined && { auth })\n\t}\n}\n\nexport function bindTool<TInput, TOutput, TAuth = unknown>(\n\ttool: ToolDefinition<TInput, TOutput>,\n\tmoduleAuth: AuthDefinition<TAuth>,\n\toptions: BindModuleOptions<TAuth>\n): ToolDefinition<TInput, TOutput> {\n\tconst previous = tool.execution ?? { run: tool.execute }\n\tconst bindContext = async (ctx: ToolContext): Promise<ToolContext> => {\n\t\tconst base = previous.bindContext ? await previous.bindContext(ctx) : ctx\n\t\treturn resolveBoundContext(moduleAuth, base, options)\n\t}\n\tconst execution: ToolExecution = {\n\t\t...previous,\n\t\tbindContext,\n\t\t...(options.hooks && { hooks: options.hooks })\n\t}\n\treturn {\n\t\t...tool,\n\t\texecution,\n\t\texecute: async (input, ctx) => execution.run(input, await bindContext(ctx))\n\t}\n}\n\nexport function bindModule<TAuth>(\n\tmodule: ModuleDefinition<TAuth>,\n\toptions: BindModuleOptions<TAuth>\n): ModuleDefinition<TAuth> {\n\tif (module.auth.type !== 'none' && !options.resolveAuth) {\n\t\tthrow new ToolError(`Module ${module.id} requires resolveAuth`, { code: 'bad_auth' })\n\t}\n\tconst scoped = options.tools !== undefined ? filterModuleTools(module, options.tools) : module\n\treturn {\n\t\t...scoped,\n\t\ttools: scoped.tools.map((tool) => bindTool(tool, scoped.auth, options))\n\t}\n}\n","// AUTO-GENERATED by `bun run codegen`. Do not edit by hand.\n/** Flat public export keys under src/{modules,vendors}. */\nexport const moduleKeys = [\n\t'amazon-sp-api',\n\t'artifacts',\n\t'bedrock-agentcore-browser',\n\t'bedrock-agentcore-code-interpreter',\n\t'browser',\n\t'calendar',\n\t'cloudflare-browser',\n\t'cloudflare-email',\n\t'cloudflare-sandbox',\n\t'code-sandbox',\n\t'content-type',\n\t'crypto',\n\t'document-extract',\n\t'document-render',\n\t'email',\n\t'email-message',\n\t'eventbridge-scheduler',\n\t'files',\n\t'image',\n\t'imessage',\n\t'katana',\n\t'mastra-vector',\n\t'messaging',\n\t'pinecone',\n\t'qdrant',\n\t'queue',\n\t'rag',\n\t'resend',\n\t's3',\n\t'scheduler',\n\t'shipstation',\n\t'skills',\n\t'slack',\n\t'sqs',\n\t'supabase-vector',\n\t'tasks',\n\t'teams',\n\t'telegram',\n\t'textract',\n\t'vector-store',\n\t'web-fetch',\n\t'woocommerce'\n] as const\n\nexport type ModuleKey = (typeof moduleKeys)[number]\n\n/** Capability seams under src/modules (brand-neutral model copy). */\nexport const moduleSeamKeys = [\n\t'artifacts',\n\t'browser',\n\t'calendar',\n\t'code-sandbox',\n\t'content-type',\n\t'crypto',\n\t'document-extract',\n\t'document-render',\n\t'email',\n\t'email-message',\n\t'files',\n\t'image',\n\t'messaging',\n\t'queue',\n\t'rag',\n\t'scheduler',\n\t'skills',\n\t'tasks',\n\t'vector-store',\n\t'web-fetch'\n] as const\n\nexport type ModuleSeamKey = (typeof moduleSeamKeys)[number]\n","import { flatMap, isPlainObject, isString } from 'es-toolkit'\nimport { isArray } from 'es-toolkit/compat'\nimport { toJSONSchema } from 'zod'\n\nimport { moduleSeamKeys } from '../generated/module-keys'\nimport type { ModuleDefinition, ToolDefinition } from './types'\nimport { duplicatesBy } from './unique'\n\nconst FORBIDDEN_MODEL_COPY =\n\t/\\b(api[_ ]?key|apiKey|bearer token|process\\.env|vault|secret key|authorization header|withAuth)\\b/i\n\n/**\n * Brand / vendor product names banned on **capability seam** model-facing copy\n * (module + tool description and input .describe()). Vendors may name their product.\n * Keep list brand-focused; avoid bare words like \"teams\" that appear in normal English.\n */\nconst FORBIDDEN_SEAM_BRAND_COPY =\n\t/\\b(Telegram|Slack|iMessage|Resend|Cloudflare|Textract|Pinecone|Qdrant|Supabase|WooCommerce|Katana|Amazon|Bot Framework|Microsoft Teams|Photon|Spectrum|Mastra|PgVector|OpenAI)\\b|\\bS3\\b|\\bR2\\b/\n\n/** Seam module ids from codegen (`src/modules/*` only — not hand-maintained). */\nconst SEAM_MODULE_IDS = new Set<string>(moduleSeamKeys)\n\nconst KEBAB_ID = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/\n\nexport type ContractIssue = {\n\tcode:\n\t\t| 'duplicate_tool_id'\n\t\t| 'empty_description'\n\t\t| 'empty_field_description'\n\t\t| 'forbidden_model_copy'\n\t\t| 'invalid_tool_id'\n\t\t| 'missing_name'\n\tmessage: string\n\tpath: string\n}\n\nexport type ContractResult = {\n\tok: boolean\n\tissues: ContractIssue[]\n}\n\nexport type CheckModelCopyOptions = {\n\t/** When true, also ban vendor brand names (capability seams). */\n\tseam?: boolean\n}\n\nfunction issue(path: string, code: ContractIssue['code'], message: string): ContractIssue {\n\treturn { path, code, message }\n}\n\nfunction checkModelCopy(\n\tpath: string,\n\ttext: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions = {}\n): void {\n\tconst trimmed = text.trim()\n\tif (!trimmed) {\n\t\tissues.push(issue(path, 'empty_description', 'Model-facing description is empty'))\n\t\treturn\n\t}\n\tif (FORBIDDEN_MODEL_COPY.test(trimmed)) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\tpath,\n\t\t\t\t'forbidden_model_copy',\n\t\t\t\t'Model-facing copy must not mention credentials, env vars, vaults, or host wiring'\n\t\t\t)\n\t\t)\n\t}\n\tif (options.seam && FORBIDDEN_SEAM_BRAND_COPY.test(trimmed)) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\tpath,\n\t\t\t\t'forbidden_model_copy',\n\t\t\t\t'Seam model-facing copy must not name vendors or products (use channel / bound store / provider-neutral language)'\n\t\t\t)\n\t\t)\n\t}\n}\n\nfunction fieldDescribes(\n\tschema: ToolDefinition['inputSchema'],\n\tpath: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions = {}\n): void {\n\tcheckFieldDescriptions(toJSONSchema(schema), `${path}.input`, issues, options)\n}\n\nfunction checkFieldDescriptions(\n\tschema: unknown,\n\tpath: string,\n\tissues: ContractIssue[],\n\toptions: CheckModelCopyOptions\n): void {\n\tif (!isPlainObject(schema)) return\n\tconst properties = schema['properties']\n\tif (isPlainObject(properties)) {\n\t\tfor (const [key, value] of Object.entries(properties)) {\n\t\t\tif (!isPlainObject(value)) continue\n\t\t\tconst fieldPath = `${path}.${key}`\n\t\t\tconst description = value['description']\n\t\t\tif (!isString(description) || description.trim().length === 0) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(fieldPath, 'empty_field_description', `Input field \"${key}\" is missing a .describe() for the model`)\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tcheckModelCopy(fieldPath, description, issues, options)\n\t\t\t}\n\t\t\tcheckFieldDescriptions(value, fieldPath, issues, options)\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(schema)) {\n\t\tif (key === 'properties') continue\n\t\tif (isArray(value)) {\n\t\t\tfor (const [index, item] of value.entries()) {\n\t\t\t\tcheckFieldDescriptions(item, `${path}.${key}[${index}]`, issues, options)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcheckFieldDescriptions(value, `${path}.${key}`, issues, options)\n\t}\n}\n\nexport function validateTool(\n\ttool: ToolDefinition,\n\tpathPrefix = tool.id,\n\toptions: CheckModelCopyOptions = {}\n): ContractResult {\n\tconst issues: ContractIssue[] = []\n\n\tif (!tool.id.trim() || !KEBAB_ID.test(tool.id)) {\n\t\tissues.push(issue(`${pathPrefix}.id`, 'invalid_tool_id', `Tool id must be kebab-case (got \"${tool.id}\")`))\n\t}\n\tif (!tool.name.trim()) {\n\t\tissues.push(issue(`${pathPrefix}.name`, 'missing_name', 'Tool name is required'))\n\t}\n\tcheckModelCopy(`${pathPrefix}.description`, tool.description, issues, options)\n\tfieldDescribes(tool.inputSchema, pathPrefix, issues, options)\n\n\treturn { ok: issues.length === 0, issues }\n}\n\nexport function validateModule(module: ModuleDefinition): ContractResult {\n\tconst issues: ContractIssue[] = []\n\tconst seam = SEAM_MODULE_IDS.has(module.id)\n\tconst copyOpts: CheckModelCopyOptions = seam ? { seam: true } : {}\n\n\tcheckModelCopy(`module.${module.id}.description`, module.description, issues, copyOpts)\n\n\tfor (const id of duplicatesBy(module.tools, (tool) => tool.id)) {\n\t\tissues.push(issue(`module.${module.id}.tools.${id}`, 'duplicate_tool_id', `Duplicate tool id \"${id}\"`))\n\t}\n\n\tissues.push(\n\t\t...flatMap(module.tools, (tool) => validateTool(tool, `module.${module.id}.tools.${tool.id}`, copyOpts).issues)\n\t)\n\n\treturn { ok: issues.length === 0, issues }\n}\n\nexport function assertContracts(result: ContractResult, label = 'contract'): void {\n\tif (result.ok) return\n\tconst detail = result.issues.map((i) => `${i.path}: ${i.message}`).join('\\n')\n\tthrow new Error(`${label} failed:\\n${detail}`)\n}\n","import { toJSONSchema } from 'zod'\n\nimport type { AuthDefinition, ModuleDefinition, ToolDefinition } from './types'\n\nexport type ToolCatalogEntry = {\n\tdescription: string\n\tid: string\n\tinputJsonSchema: Record<string, unknown>\n\tname: string\n\toutputJsonSchema: Record<string, unknown>\n\truntime: ToolDefinition['meta']['runtime']\n\tsideEffect: ToolDefinition['meta']['sideEffect']\n\ttags: readonly string[]\n\tidempotent?: boolean | undefined\n\tlongRunning?: boolean | undefined\n\trequiresConfirmation?: boolean | undefined\n\tsupportsCancel?: boolean | undefined\n\tsupportsProgress?: boolean | undefined\n\tnetwork?: boolean | undefined\n\tartifacts?: boolean | undefined\n}\n\nexport type ModuleCatalogEntry = {\n\tauthType: AuthDefinition<unknown>['type']\n\tdescription: string\n\tid: string\n\truntime: ModuleDefinition['runtime']\n\ttitle: string\n\ttools: ToolCatalogEntry[]\n\t/** Inline SVG when the pack has a logo. */\n\tlogo?: string | undefined\n\tcategories: readonly string[]\n\tclassification?: ModuleDefinition['classification']\n\ttags: readonly string[]\n}\n\nexport function toToolCatalogEntry(tool: ToolDefinition): ToolCatalogEntry {\n\treturn {\n\t\tid: tool.id,\n\t\tname: tool.name,\n\t\tdescription: tool.description,\n\t\truntime: tool.meta.runtime,\n\t\tsideEffect: tool.meta.sideEffect,\n\t\ttags: tool.meta.tags ?? [],\n\t\tidempotent: tool.meta.idempotent,\n\t\tlongRunning: tool.meta.longRunning,\n\t\trequiresConfirmation: tool.meta.requiresConfirmation,\n\t\tsupportsCancel: tool.meta.supportsCancel,\n\t\tsupportsProgress: tool.meta.supportsProgress,\n\t\tnetwork: tool.meta.network,\n\t\tartifacts: tool.meta.artifacts,\n\t\tinputJsonSchema: toJSONSchema(tool.inputSchema),\n\t\toutputJsonSchema: toJSONSchema(tool.outputSchema)\n\t}\n}\n\nexport function toModuleCatalogEntry(module: ModuleDefinition): ModuleCatalogEntry {\n\treturn {\n\t\tid: module.id,\n\t\ttitle: module.title,\n\t\tdescription: module.description,\n\t\truntime: module.runtime,\n\t\tauthType: module.auth.type,\n\t\ttools: module.tools.map(toToolCatalogEntry),\n\t\tcategories: module.categories,\n\t\ttags: module.tags ?? [],\n\t\t...(module.classification !== undefined && { classification: module.classification }),\n\t\t...(module.logo !== undefined && { logo: module.logo })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,WAAkB,MAA6B,OAAmC;CAC1F,IAAI,KAAK,SAAS,QAAQ;EACzB,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,UAAU,kCAAkC,EAAE,MAAM,WAAW,CAAC;EACnG;CACD;CACA,MAAM,SAAS,KAAK,OAAO,UAAU,KAAK;CAC1C,IAAI,CAAC,OAAO,SACX,MAAM,IAAI,UAAU,4BAA4B;EAC/C,MAAM;EACN,SAAS,EAAE,QAAQ,OAAO,MAAM,OAAO,KAAK,MAAM,EAAE,OAAO,EAAE;CAC9D,CAAC;CAEF,OAAO,OAAO;AACf;AAaA,eAAe,oBACd,YACA,UACA,SACuB;CACvB,MAAM,OAAO,QAAQ,iBAClB,iBAAiB,UAAU,MAAM,QAAQ,eAAe,QAAQ,CAAC,IACjE,EAAE,GAAG,SAAS;CACjB,IAAI,WAAW,SAAS,QAAQ,OAAO;CACvC,IAAI,CAAC,QAAQ,aACZ,MAAM,IAAI,UAAU,yDAAyD,EAAE,MAAM,WAAW,CAAC;CAElG,MAAM,OAAO,WAAW,YAAY,MAAM,QAAQ,YAAY,IAAI,CAAC;CACnE,OAAO;EACN,GAAG;EACH,GAAI,SAAS,KAAA,KAAa,EAAE,KAAK;CAClC;A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AAK;EACX,aAAa,KAAK;EAClB,SAAS,KAAK,KAAK;EACnB,YAAY,KAAK,KAAK;EACtB,MAAM,KAAK,KAAK,QAAQ,CAAC;EACzB,YAAY,KAAK,KAAK;EACtB,aAAa,KAAK,KAAK;EACvB,sBAAsB,KAAK,KAAK;EAChC,gBAAgB,KAAK,KAAK;EAC1B,kBAAkB,KAAK,KAAK;EAC5B,SAAS,KAAK,KAAK;EACnB,WAAW,KAAK,KAAK;EACrB,iBAAiB,aAAa,KAAK,WAAW;EAC9C,kBAAkB,aAAa,KAAK,YAAY;CACjD;AACD;AAEA,SAAgB,qBAAqB,QAA8C;CAClF,OAAO;EACN,IAAI,OAAO;EACX,OAAO,OAAO;EACd,aAAa,OAAO;EACpB,SAAS,OAAO;EAChB,UAAU,OAAO,KAAK;EACtB,OAAO,OAAO,MAAM,IAAI,kBAAkB;EAC1C,YAAY,OAAO;EACnB,MAAM,OAAO,QAAQ,CAAC;EACtB,GAAI,OAAO,mBAAmB,KAAA,KAAa,EAAE,gBAAgB,OAAO,eAAe;EACnF,GAAI,OAAO,SAAS,KAAA,KAAa,EAAE,MAAM,OAAO,KAAK;CACtD;AACD"}
@@ -0,0 +1,256 @@
1
+ import { a as ModuleDefinition, o as ToolContext, s as ToolDefinition } from "../../types-Ccb0DXY9.js";
2
+ import "../../index-CZX5OeOF.js";
3
+ import { s as HttpServiceOptions } from "../../http-service-CerzWwQO.js";
4
+ import { z } from "zod";
5
+ //#region src/vendors/shipstation/contracts.d.ts
6
+ declare const shipstationAuthSchema: z.ZodObject<{
7
+ api_key: z.ZodString;
8
+ }, z.core.$strip>;
9
+ type ShipstationAuth = z.infer<typeof shipstationAuthSchema>;
10
+ declare const shipstationLabelRawSchema: z.ZodObject<{
11
+ label_id: z.ZodString;
12
+ shipment_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ tracking_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ ship_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ voided_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ }, z.core.$loose>;
21
+ declare const shipstationShipmentRawSchema: z.ZodObject<{
22
+ shipment_id: z.ZodString;
23
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ shipment_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ shipment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ }, z.core.$loose>;
29
+ declare const shipstationPaginationSchema: z.ZodObject<{
30
+ total: z.ZodInt;
31
+ page: z.ZodInt;
32
+ pages: z.ZodInt;
33
+ page_size: z.ZodInt;
34
+ has_more: z.ZodBoolean;
35
+ }, z.core.$strip>;
36
+ declare const shipstationListLabelsPageInputSchema: z.ZodObject<{
37
+ page: z.ZodOptional<z.ZodInt>;
38
+ page_size: z.ZodOptional<z.ZodInt>;
39
+ label_status: z.ZodOptional<z.ZodString>;
40
+ service_code: z.ZodOptional<z.ZodString>;
41
+ carrier_id: z.ZodOptional<z.ZodString>;
42
+ tracking_number: z.ZodOptional<z.ZodString>;
43
+ batch_id: z.ZodOptional<z.ZodString>;
44
+ rate_id: z.ZodOptional<z.ZodString>;
45
+ shipment_id: z.ZodOptional<z.ZodString>;
46
+ external_shipment_id: z.ZodOptional<z.ZodString>;
47
+ warehouse_id: z.ZodOptional<z.ZodString>;
48
+ created_at_start: z.ZodOptional<z.ZodISODateTime>;
49
+ created_at_end: z.ZodOptional<z.ZodISODateTime>;
50
+ refund_status: z.ZodOptional<z.ZodString>;
51
+ sort_dir: z.ZodOptional<z.ZodEnum<{
52
+ asc: "asc";
53
+ desc: "desc";
54
+ }>>;
55
+ sort_by: z.ZodOptional<z.ZodEnum<{
56
+ created_at: "created_at";
57
+ modified_at: "modified_at";
58
+ voided_at: "voided_at";
59
+ }>>;
60
+ }, z.core.$strict>;
61
+ declare const shipstationListLabelsPageOutputSchema: z.ZodObject<{
62
+ items: z.ZodArray<z.ZodObject<{
63
+ label_id: z.ZodString;
64
+ shipment_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ tracking_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ ship_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ voided_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ }, z.core.$loose>>;
73
+ pagination: z.ZodObject<{
74
+ total: z.ZodInt;
75
+ page: z.ZodInt;
76
+ pages: z.ZodInt;
77
+ page_size: z.ZodInt;
78
+ has_more: z.ZodBoolean;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strip>;
81
+ declare const shipstationListShipmentsPageInputSchema: z.ZodObject<{
82
+ page: z.ZodOptional<z.ZodInt>;
83
+ page_size: z.ZodOptional<z.ZodInt>;
84
+ shipment_status: z.ZodOptional<z.ZodString>;
85
+ batch_id: z.ZodOptional<z.ZodString>;
86
+ pickup_id: z.ZodOptional<z.ZodString>;
87
+ created_at_start: z.ZodOptional<z.ZodISODateTime>;
88
+ created_at_end: z.ZodOptional<z.ZodISODateTime>;
89
+ modified_at_start: z.ZodOptional<z.ZodISODateTime>;
90
+ modified_at_end: z.ZodOptional<z.ZodISODateTime>;
91
+ sales_order_id: z.ZodOptional<z.ZodString>;
92
+ shipment_number: z.ZodOptional<z.ZodString>;
93
+ ship_to_name: z.ZodOptional<z.ZodString>;
94
+ item_keyword: z.ZodOptional<z.ZodString>;
95
+ payment_date_start: z.ZodOptional<z.ZodISODateTime>;
96
+ payment_date_end: z.ZodOptional<z.ZodISODateTime>;
97
+ store_id: z.ZodOptional<z.ZodString>;
98
+ external_shipment_id: z.ZodOptional<z.ZodString>;
99
+ sort_dir: z.ZodOptional<z.ZodEnum<{
100
+ asc: "asc";
101
+ desc: "desc";
102
+ }>>;
103
+ sort_by: z.ZodOptional<z.ZodEnum<{
104
+ created_at: "created_at";
105
+ modified_at: "modified_at";
106
+ }>>;
107
+ }, z.core.$strict>;
108
+ declare const shipstationListShipmentsPageOutputSchema: z.ZodObject<{
109
+ items: z.ZodArray<z.ZodObject<{
110
+ shipment_id: z.ZodString;
111
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ shipment_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ shipment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
+ }, z.core.$loose>>;
117
+ pagination: z.ZodObject<{
118
+ total: z.ZodInt;
119
+ page: z.ZodInt;
120
+ pages: z.ZodInt;
121
+ page_size: z.ZodInt;
122
+ has_more: z.ZodBoolean;
123
+ }, z.core.$strip>;
124
+ }, z.core.$strip>;
125
+ declare const shipstationListLabelsResponseSchema: z.ZodObject<{
126
+ labels: z.ZodArray<z.ZodObject<{
127
+ label_id: z.ZodString;
128
+ shipment_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ tracking_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ ship_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ voided_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ }, z.core.$loose>>;
137
+ total: z.ZodInt;
138
+ page: z.ZodInt;
139
+ pages: z.ZodInt;
140
+ }, z.core.$loose>;
141
+ declare const shipstationListShipmentsResponseSchema: z.ZodObject<{
142
+ shipments: z.ZodArray<z.ZodObject<{
143
+ shipment_id: z.ZodString;
144
+ external_order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
+ shipment_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
+ modified_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
+ shipment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
+ }, z.core.$loose>>;
150
+ total: z.ZodInt;
151
+ page: z.ZodInt;
152
+ pages: z.ZodInt;
153
+ }, z.core.$loose>;
154
+ type ShipstationLabelRaw = z.infer<typeof shipstationLabelRawSchema>;
155
+ type ShipstationShipmentRaw = z.infer<typeof shipstationShipmentRawSchema>;
156
+ type ShipstationPagination = z.infer<typeof shipstationPaginationSchema>;
157
+ type ShipstationListLabelsPageInput = z.infer<typeof shipstationListLabelsPageInputSchema>;
158
+ type ShipstationListLabelsPageOutput = z.infer<typeof shipstationListLabelsPageOutputSchema>;
159
+ type ShipstationListShipmentsPageInput = z.infer<typeof shipstationListShipmentsPageInputSchema>;
160
+ type ShipstationListShipmentsPageOutput = z.infer<typeof shipstationListShipmentsPageOutputSchema>;
161
+ //#endregion
162
+ //#region src/vendors/shipstation/client.d.ts
163
+ type ShipstationClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>;
164
+ declare class ShipstationClient {
165
+ #private;
166
+ constructor(auth: ShipstationAuth, options?: ShipstationClientOptions);
167
+ static fromContext(ctx: ToolContext): ShipstationClient;
168
+ /** One GET /labels request with provider pagination and filters. */
169
+ listLabelsPage(input?: ShipstationListLabelsPageInput): Promise<ShipstationListLabelsPageOutput>;
170
+ /** One GET /shipments request with provider pagination and filters. */
171
+ listShipmentsPage(input?: ShipstationListShipmentsPageInput): Promise<ShipstationListShipmentsPageOutput>;
172
+ }
173
+ //#endregion
174
+ //#region src/vendors/shipstation/module.d.ts
175
+ declare const shipstationListLabelsTool: ToolDefinition<{
176
+ page?: number | undefined;
177
+ page_size?: number | undefined;
178
+ label_status?: string | undefined;
179
+ service_code?: string | undefined;
180
+ carrier_id?: string | undefined;
181
+ tracking_number?: string | undefined;
182
+ batch_id?: string | undefined;
183
+ rate_id?: string | undefined;
184
+ shipment_id?: string | undefined;
185
+ external_shipment_id?: string | undefined;
186
+ warehouse_id?: string | undefined;
187
+ created_at_start?: string | undefined;
188
+ created_at_end?: string | undefined;
189
+ refund_status?: string | undefined;
190
+ sort_dir?: "asc" | "desc" | undefined;
191
+ sort_by?: "created_at" | "modified_at" | "voided_at" | undefined;
192
+ }, {
193
+ items: {
194
+ [x: string]: unknown;
195
+ label_id: string;
196
+ shipment_id?: string | null | undefined;
197
+ external_order_id?: string | null | undefined;
198
+ tracking_number?: string | null | undefined;
199
+ created_at?: string | null | undefined;
200
+ modified_at?: string | null | undefined;
201
+ ship_date?: string | null | undefined;
202
+ voided_at?: string | null | undefined;
203
+ status?: string | null | undefined;
204
+ }[];
205
+ pagination: {
206
+ total: number;
207
+ page: number;
208
+ pages: number;
209
+ page_size: number;
210
+ has_more: boolean;
211
+ };
212
+ }>;
213
+ declare const shipstationListShipmentsTool: ToolDefinition<{
214
+ page?: number | undefined;
215
+ page_size?: number | undefined;
216
+ shipment_status?: string | undefined;
217
+ batch_id?: string | undefined;
218
+ pickup_id?: string | undefined;
219
+ created_at_start?: string | undefined;
220
+ created_at_end?: string | undefined;
221
+ modified_at_start?: string | undefined;
222
+ modified_at_end?: string | undefined;
223
+ sales_order_id?: string | undefined;
224
+ shipment_number?: string | undefined;
225
+ ship_to_name?: string | undefined;
226
+ item_keyword?: string | undefined;
227
+ payment_date_start?: string | undefined;
228
+ payment_date_end?: string | undefined;
229
+ store_id?: string | undefined;
230
+ external_shipment_id?: string | undefined;
231
+ sort_dir?: "asc" | "desc" | undefined;
232
+ sort_by?: "created_at" | "modified_at" | undefined;
233
+ }, {
234
+ items: {
235
+ [x: string]: unknown;
236
+ shipment_id: string;
237
+ external_order_id?: string | null | undefined;
238
+ shipment_number?: string | null | undefined;
239
+ created_at?: string | null | undefined;
240
+ modified_at?: string | null | undefined;
241
+ shipment_status?: string | null | undefined;
242
+ }[];
243
+ pagination: {
244
+ total: number;
245
+ page: number;
246
+ pages: number;
247
+ page_size: number;
248
+ has_more: boolean;
249
+ };
250
+ }>;
251
+ declare const shipstationModule: ModuleDefinition<{
252
+ api_key: string;
253
+ }>;
254
+ //#endregion
255
+ export { type ShipstationAuth, ShipstationClient, type ShipstationClientOptions, type ShipstationLabelRaw, type ShipstationListLabelsPageInput, type ShipstationListLabelsPageOutput, type ShipstationListShipmentsPageInput, type ShipstationListShipmentsPageOutput, type ShipstationPagination, type ShipstationShipmentRaw, shipstationAuthSchema, shipstationLabelRawSchema, shipstationListLabelsPageInputSchema, shipstationListLabelsPageOutputSchema, shipstationListLabelsResponseSchema, shipstationListLabelsTool, shipstationListShipmentsPageInputSchema, shipstationListShipmentsPageOutputSchema, shipstationListShipmentsResponseSchema, shipstationListShipmentsTool, shipstationModule, shipstationPaginationSchema, shipstationShipmentRawSchema };
256
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/vendors/shipstation/contracts.ts","../../../src/vendors/shipstation/client.ts","../../../src/vendors/shipstation/module.ts"],"mappings":";;;;;cAEa,uBAAqB,EAAA;;GAEhC,EAAA,KAAA;KAEU,kBAAkB,EAAE,aAAa;cAUhC,2BAAyB,EAAA;;;;;;;;;;GAUpC,EAAA,KAAA;cAEW,8BAA4B,EAAA;;;;;;;GAOvC,EAAA,KAAA;cAEW,6BAA2B,EAAA;;;;;;GAMtC,EAAA,KAAA;cAEW,sCAAoC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;GA0B/C,EAAA,KAAA;cAEW,uCAAqC,EAAA;;;;;;;;;;;;;;;;;;;GAGhD,EAAA,KAAA;cAEW,yCAAuC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GAsClD,EAAA,KAAA;cAEW,0CAAwC,EAAA;;;;;;;;;;;;;;;;GAGnD,EAAA,KAAA;cAEW,qCAAmC,EAAA;;;;;;;;;;;;;;;GAK9C,EAAA,KAAA;cAEW,wCAAsC,EAAA;;;;;;;;;;;;GAKjD,EAAA,KAAA;KAEU,sBAAsB,EAAE,aAAa;KACrC,yBAAyB,EAAE,aAAa;KACxC,wBAAwB,EAAE,aAAa;KACvC,iCAAiC,EAAE,aAAa;KAChD,kCAAkC,EAAE,aAAa;KACjD,oCAAoC,EAAE,aAAa;KACnD,qCAAqC,EAAE,aAAa;;;KCnHpD,2BAA2B,KAAK;cAE/B;;EAGZ,YAAY,MAAM,iBAAiB,UAAS;SAoBrC,YAAY,KAAK,cAAc;;EAShC,eAAe,QAAO,iCAAsC,QAAQ;;EAoCpE,kBAAkB,QAAO,oCAAyC,QAAQ;;;;cCxFpE,2BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgBA,8BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgBA,mBAAA;EAAiB"}
@@ -0,0 +1,261 @@
1
+ import { t as ToolError } from "../../errors-DoSpNHvs.js";
2
+ import { n as defineModule, r as defineTool } from "../../define-ieoksEQ0.js";
3
+ import { n as requireAuth } from "../../provider-CgDAlg6K.js";
4
+ import { t as HttpService } from "../../http-service-BMBIryAL.js";
5
+ import { z } from "zod";
6
+ //#region src/vendors/shipstation/contracts.ts
7
+ const shipstationAuthSchema = z.object({ api_key: z.string().min(1).describe("ShipStation V2 API key") });
8
+ const shipstationPageSchema = z.int().min(1).optional().describe("Provider page number, starting at 1");
9
+ const shipstationPageSizeSchema = z.int().min(1).max(500).optional().describe("Records per page, from 1 to 500; defaults to 25");
10
+ const shipstationLabelRawSchema = z.looseObject({
11
+ label_id: z.string().min(1),
12
+ shipment_id: z.string().nullable().optional(),
13
+ external_order_id: z.string().nullable().optional(),
14
+ tracking_number: z.string().nullable().optional(),
15
+ created_at: z.string().nullable().optional(),
16
+ modified_at: z.string().nullable().optional(),
17
+ ship_date: z.string().nullable().optional(),
18
+ voided_at: z.string().nullable().optional(),
19
+ status: z.string().nullable().optional()
20
+ });
21
+ const shipstationShipmentRawSchema = z.looseObject({
22
+ shipment_id: z.string().min(1),
23
+ external_order_id: z.string().nullable().optional(),
24
+ shipment_number: z.string().nullable().optional(),
25
+ created_at: z.string().nullable().optional(),
26
+ modified_at: z.string().nullable().optional(),
27
+ shipment_status: z.string().nullable().optional()
28
+ });
29
+ const shipstationPaginationSchema = z.object({
30
+ total: z.int().nonnegative(),
31
+ page: z.int().min(1),
32
+ pages: z.int().nonnegative(),
33
+ page_size: z.int().min(1).max(500),
34
+ has_more: z.boolean()
35
+ });
36
+ const shipstationListLabelsPageInputSchema = z.strictObject({
37
+ page: shipstationPageSchema,
38
+ page_size: shipstationPageSizeSchema,
39
+ label_status: z.string().min(1).optional().describe("Label status filter"),
40
+ service_code: z.string().min(1).optional().describe("Carrier service code filter"),
41
+ carrier_id: z.string().min(1).optional().describe("ShipStation carrier id filter"),
42
+ tracking_number: z.string().min(1).optional().describe("Exact tracking number filter"),
43
+ batch_id: z.string().min(1).optional().describe("ShipStation batch id filter"),
44
+ rate_id: z.string().min(1).optional().describe("ShipStation rate id filter"),
45
+ shipment_id: z.string().min(1).optional().describe("ShipStation shipment id filter"),
46
+ external_shipment_id: z.string().min(1).optional().describe("External shipment id filter"),
47
+ warehouse_id: z.string().min(1).optional().describe("ShipStation warehouse id filter"),
48
+ created_at_start: z.iso.datetime({ offset: true }).optional().describe("Include labels created at or after this ISO 8601 timestamp"),
49
+ created_at_end: z.iso.datetime({ offset: true }).optional().describe("Include labels created at or before this ISO 8601 timestamp"),
50
+ refund_status: z.string().min(1).optional().describe("Label refund status filter"),
51
+ sort_dir: z.enum(["asc", "desc"]).optional().describe("Provider slice direction; defaults to desc"),
52
+ sort_by: z.enum([
53
+ "modified_at",
54
+ "created_at",
55
+ "voided_at"
56
+ ]).optional().describe("Label field used to sort the provider slice")
57
+ });
58
+ const shipstationListLabelsPageOutputSchema = z.object({
59
+ items: z.array(shipstationLabelRawSchema),
60
+ pagination: shipstationPaginationSchema
61
+ });
62
+ const shipstationListShipmentsPageInputSchema = z.strictObject({
63
+ page: shipstationPageSchema,
64
+ page_size: shipstationPageSizeSchema,
65
+ shipment_status: z.string().min(1).optional().describe("Shipment status filter"),
66
+ batch_id: z.string().min(1).optional().describe("ShipStation batch id filter"),
67
+ pickup_id: z.string().min(1).optional().describe("ShipStation pickup id filter"),
68
+ created_at_start: z.iso.datetime({ offset: true }).optional().describe("Include shipments created at or after this ISO 8601 timestamp"),
69
+ created_at_end: z.iso.datetime({ offset: true }).optional().describe("Include shipments created at or before this ISO 8601 timestamp"),
70
+ modified_at_start: z.iso.datetime({ offset: true }).optional().describe("Include shipments modified at or after this ISO 8601 timestamp"),
71
+ modified_at_end: z.iso.datetime({ offset: true }).optional().describe("Include shipments modified at or before this ISO 8601 timestamp"),
72
+ sales_order_id: z.string().min(1).optional().describe("Sales order id filter"),
73
+ shipment_number: z.string().min(1).optional().describe("Shipment number filter"),
74
+ ship_to_name: z.string().min(1).optional().describe("Recipient name filter"),
75
+ item_keyword: z.string().min(1).optional().describe("Shipment item keyword filter"),
76
+ payment_date_start: z.iso.datetime({ offset: true }).optional().describe("Include shipments paid at or after this ISO 8601 timestamp"),
77
+ payment_date_end: z.iso.datetime({ offset: true }).optional().describe("Include shipments paid at or before this ISO 8601 timestamp"),
78
+ store_id: z.string().min(1).optional().describe("ShipStation store id filter"),
79
+ external_shipment_id: z.string().min(1).optional().describe("External shipment id filter"),
80
+ sort_dir: z.enum(["asc", "desc"]).optional().describe("Provider slice direction; defaults to desc"),
81
+ sort_by: z.enum(["modified_at", "created_at"]).optional().describe("Shipment field used to sort the provider slice")
82
+ });
83
+ const shipstationListShipmentsPageOutputSchema = z.object({
84
+ items: z.array(shipstationShipmentRawSchema),
85
+ pagination: shipstationPaginationSchema
86
+ });
87
+ const shipstationListLabelsResponseSchema = z.looseObject({
88
+ labels: z.array(shipstationLabelRawSchema),
89
+ total: z.int().nonnegative(),
90
+ page: z.int().min(1),
91
+ pages: z.int().nonnegative()
92
+ });
93
+ const shipstationListShipmentsResponseSchema = z.looseObject({
94
+ shipments: z.array(shipstationShipmentRawSchema),
95
+ total: z.int().nonnegative(),
96
+ page: z.int().min(1),
97
+ pages: z.int().nonnegative()
98
+ });
99
+ //#endregion
100
+ //#region src/vendors/shipstation/client.ts
101
+ /**
102
+ * ShipStation V2 vendor client.
103
+ * Host: `new ShipstationClient(auth)`. Agent tools: `fromContext(ctx)`.
104
+ */
105
+ const SHIPSTATION_API_BASE = "https://api.shipstation.com/v2";
106
+ const DEFAULT_PAGE_SIZE = 25;
107
+ var ShipstationClient = class ShipstationClient {
108
+ #http;
109
+ constructor(auth, options = {}) {
110
+ const parsed = shipstationAuthSchema.safeParse(auth);
111
+ if (!parsed.success) throw new ToolError("Invalid ShipStation auth credentials", {
112
+ code: "bad_auth",
113
+ details: { issues: parsed.error.issues.map((issue) => issue.message) }
114
+ });
115
+ this.#http = new HttpService({
116
+ ...options,
117
+ baseURL: SHIPSTATION_API_BASE,
118
+ headers: {
119
+ Accept: "application/json",
120
+ "API-Key": parsed.data.api_key
121
+ },
122
+ label: "ShipStation"
123
+ });
124
+ }
125
+ static fromContext(ctx) {
126
+ const auth = requireAuth(ctx, shipstationAuthSchema);
127
+ return new ShipstationClient(auth, {
128
+ ...ctx.fetch && { fetch: ctx.fetch },
129
+ ...ctx.signal && { signal: ctx.signal }
130
+ });
131
+ }
132
+ /** One GET /labels request with provider pagination and filters. */
133
+ async listLabelsPage(input = {}) {
134
+ const parsedInput = shipstationListLabelsPageInputSchema.safeParse(input);
135
+ if (!parsedInput.success) throw new ToolError("Invalid ShipStation labels page input", {
136
+ code: "bad_input",
137
+ details: { issues: parsedInput.error.issues.map((issue) => issue.message) }
138
+ });
139
+ const page = parsedInput.data.page ?? 1;
140
+ const pageSize = parsedInput.data.page_size ?? DEFAULT_PAGE_SIZE;
141
+ const { data } = await this.#http.get("/labels", {
142
+ label: "ShipStation listLabelsPage",
143
+ query: {
144
+ ...parsedInput.data,
145
+ page,
146
+ page_size: pageSize
147
+ }
148
+ });
149
+ const parsedResponse = shipstationListLabelsResponseSchema.safeParse(data);
150
+ if (!parsedResponse.success) throw new ToolError("ShipStation returned an invalid labels page", {
151
+ code: "upstream",
152
+ details: { issues: parsedResponse.error.issues.map((issue) => issue.message) }
153
+ });
154
+ return {
155
+ items: parsedResponse.data.labels,
156
+ pagination: {
157
+ total: parsedResponse.data.total,
158
+ page: parsedResponse.data.page,
159
+ pages: parsedResponse.data.pages,
160
+ page_size: pageSize,
161
+ has_more: parsedResponse.data.page < parsedResponse.data.pages
162
+ }
163
+ };
164
+ }
165
+ /** One GET /shipments request with provider pagination and filters. */
166
+ async listShipmentsPage(input = {}) {
167
+ const parsedInput = shipstationListShipmentsPageInputSchema.safeParse(input);
168
+ if (!parsedInput.success) throw new ToolError("Invalid ShipStation shipments page input", {
169
+ code: "bad_input",
170
+ details: { issues: parsedInput.error.issues.map((issue) => issue.message) }
171
+ });
172
+ const page = parsedInput.data.page ?? 1;
173
+ const pageSize = parsedInput.data.page_size ?? DEFAULT_PAGE_SIZE;
174
+ const { data } = await this.#http.get("/shipments", {
175
+ label: "ShipStation listShipmentsPage",
176
+ query: {
177
+ ...parsedInput.data,
178
+ page,
179
+ page_size: pageSize
180
+ }
181
+ });
182
+ const parsedResponse = shipstationListShipmentsResponseSchema.safeParse(data);
183
+ if (!parsedResponse.success) throw new ToolError("ShipStation returned an invalid shipments page", {
184
+ code: "upstream",
185
+ details: { issues: parsedResponse.error.issues.map((issue) => issue.message) }
186
+ });
187
+ return {
188
+ items: parsedResponse.data.shipments,
189
+ pagination: {
190
+ total: parsedResponse.data.total,
191
+ page: parsedResponse.data.page,
192
+ pages: parsedResponse.data.pages,
193
+ page_size: pageSize,
194
+ has_more: parsedResponse.data.page < parsedResponse.data.pages
195
+ }
196
+ };
197
+ }
198
+ };
199
+ //#endregion
200
+ //#region src/vendors/shipstation/module.ts
201
+ const shipstationListLabelsTool = defineTool({
202
+ id: "shipstation-list-labels",
203
+ name: "shipstationListLabels",
204
+ description: "List one page of ShipStation labels. Filter by creation time, status, carrier, service, tracking number, shipment, warehouse, batch, rate, or refund status.",
205
+ inputSchema: shipstationListLabelsPageInputSchema,
206
+ outputSchema: shipstationListLabelsPageOutputSchema,
207
+ sideEffect: "read",
208
+ runtime: "both",
209
+ idempotent: true,
210
+ network: true,
211
+ supportsCancel: true,
212
+ tags: [
213
+ "labels",
214
+ "shipping",
215
+ "tracking",
216
+ "fulfillment"
217
+ ],
218
+ execute: async (input, ctx) => ShipstationClient.fromContext(ctx).listLabelsPage(input)
219
+ });
220
+ const shipstationListShipmentsTool = defineTool({
221
+ id: "shipstation-list-shipments",
222
+ name: "shipstationListShipments",
223
+ description: "List one page of ShipStation shipments. Filter by creation, modification, or payment time plus status, order, store, recipient, item, batch, pickup, or shipment identifiers.",
224
+ inputSchema: shipstationListShipmentsPageInputSchema,
225
+ outputSchema: shipstationListShipmentsPageOutputSchema,
226
+ sideEffect: "read",
227
+ runtime: "both",
228
+ idempotent: true,
229
+ network: true,
230
+ supportsCancel: true,
231
+ tags: [
232
+ "shipments",
233
+ "shipping",
234
+ "orders",
235
+ "fulfillment"
236
+ ],
237
+ execute: async (input, ctx) => ShipstationClient.fromContext(ctx).listShipmentsPage(input)
238
+ });
239
+ const shipstationModule = defineModule({
240
+ id: "shipstation",
241
+ title: "ShipStation",
242
+ description: "ShipStation V2 vendor pack for paginated label and shipment reads.",
243
+ runtime: "both",
244
+ auth: {
245
+ type: "custom",
246
+ schema: shipstationAuthSchema
247
+ },
248
+ categories: ["commerce", "shipping"],
249
+ classification: "pii",
250
+ tags: [
251
+ "labels",
252
+ "shipments",
253
+ "tracking",
254
+ "fulfillment"
255
+ ],
256
+ tools: [shipstationListLabelsTool, shipstationListShipmentsTool]
257
+ });
258
+ //#endregion
259
+ export { ShipstationClient, shipstationAuthSchema, shipstationLabelRawSchema, shipstationListLabelsPageInputSchema, shipstationListLabelsPageOutputSchema, shipstationListLabelsResponseSchema, shipstationListLabelsTool, shipstationListShipmentsPageInputSchema, shipstationListShipmentsPageOutputSchema, shipstationListShipmentsResponseSchema, shipstationListShipmentsTool, shipstationModule, shipstationPaginationSchema, shipstationShipmentRawSchema };
260
+
261
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["#http"],"sources":["../../../src/vendors/shipstation/contracts.ts","../../../src/vendors/shipstation/client.ts","../../../src/vendors/shipstation/module.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const shipstationAuthSchema = z.object({\n\tapi_key: z.string().min(1).describe('ShipStation V2 API key')\n})\n\nexport type ShipstationAuth = z.infer<typeof shipstationAuthSchema>\n\nconst shipstationPageSchema = z.int().min(1).optional().describe('Provider page number, starting at 1')\nconst shipstationPageSizeSchema = z\n\t.int()\n\t.min(1)\n\t.max(500)\n\t.optional()\n\t.describe('Records per page, from 1 to 500; defaults to 25')\n\nexport const shipstationLabelRawSchema = z.looseObject({\n\tlabel_id: z.string().min(1),\n\tshipment_id: z.string().nullable().optional(),\n\texternal_order_id: z.string().nullable().optional(),\n\ttracking_number: z.string().nullable().optional(),\n\tcreated_at: z.string().nullable().optional(),\n\tmodified_at: z.string().nullable().optional(),\n\tship_date: z.string().nullable().optional(),\n\tvoided_at: z.string().nullable().optional(),\n\tstatus: z.string().nullable().optional()\n})\n\nexport const shipstationShipmentRawSchema = z.looseObject({\n\tshipment_id: z.string().min(1),\n\texternal_order_id: z.string().nullable().optional(),\n\tshipment_number: z.string().nullable().optional(),\n\tcreated_at: z.string().nullable().optional(),\n\tmodified_at: z.string().nullable().optional(),\n\tshipment_status: z.string().nullable().optional()\n})\n\nexport const shipstationPaginationSchema = z.object({\n\ttotal: z.int().nonnegative(),\n\tpage: z.int().min(1),\n\tpages: z.int().nonnegative(),\n\tpage_size: z.int().min(1).max(500),\n\thas_more: z.boolean()\n})\n\nexport const shipstationListLabelsPageInputSchema = z.strictObject({\n\tpage: shipstationPageSchema,\n\tpage_size: shipstationPageSizeSchema,\n\tlabel_status: z.string().min(1).optional().describe('Label status filter'),\n\tservice_code: z.string().min(1).optional().describe('Carrier service code filter'),\n\tcarrier_id: z.string().min(1).optional().describe('ShipStation carrier id filter'),\n\ttracking_number: z.string().min(1).optional().describe('Exact tracking number filter'),\n\tbatch_id: z.string().min(1).optional().describe('ShipStation batch id filter'),\n\trate_id: z.string().min(1).optional().describe('ShipStation rate id filter'),\n\tshipment_id: z.string().min(1).optional().describe('ShipStation shipment id filter'),\n\texternal_shipment_id: z.string().min(1).optional().describe('External shipment id filter'),\n\twarehouse_id: z.string().min(1).optional().describe('ShipStation warehouse id filter'),\n\tcreated_at_start: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include labels created at or after this ISO 8601 timestamp'),\n\tcreated_at_end: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include labels created at or before this ISO 8601 timestamp'),\n\trefund_status: z.string().min(1).optional().describe('Label refund status filter'),\n\tsort_dir: z.enum(['asc', 'desc']).optional().describe('Provider slice direction; defaults to desc'),\n\tsort_by: z\n\t\t.enum(['modified_at', 'created_at', 'voided_at'])\n\t\t.optional()\n\t\t.describe('Label field used to sort the provider slice')\n})\n\nexport const shipstationListLabelsPageOutputSchema = z.object({\n\titems: z.array(shipstationLabelRawSchema),\n\tpagination: shipstationPaginationSchema\n})\n\nexport const shipstationListShipmentsPageInputSchema = z.strictObject({\n\tpage: shipstationPageSchema,\n\tpage_size: shipstationPageSizeSchema,\n\tshipment_status: z.string().min(1).optional().describe('Shipment status filter'),\n\tbatch_id: z.string().min(1).optional().describe('ShipStation batch id filter'),\n\tpickup_id: z.string().min(1).optional().describe('ShipStation pickup id filter'),\n\tcreated_at_start: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments created at or after this ISO 8601 timestamp'),\n\tcreated_at_end: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments created at or before this ISO 8601 timestamp'),\n\tmodified_at_start: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments modified at or after this ISO 8601 timestamp'),\n\tmodified_at_end: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments modified at or before this ISO 8601 timestamp'),\n\tsales_order_id: z.string().min(1).optional().describe('Sales order id filter'),\n\tshipment_number: z.string().min(1).optional().describe('Shipment number filter'),\n\tship_to_name: z.string().min(1).optional().describe('Recipient name filter'),\n\titem_keyword: z.string().min(1).optional().describe('Shipment item keyword filter'),\n\tpayment_date_start: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments paid at or after this ISO 8601 timestamp'),\n\tpayment_date_end: z.iso\n\t\t.datetime({ offset: true })\n\t\t.optional()\n\t\t.describe('Include shipments paid at or before this ISO 8601 timestamp'),\n\tstore_id: z.string().min(1).optional().describe('ShipStation store id filter'),\n\texternal_shipment_id: z.string().min(1).optional().describe('External shipment id filter'),\n\tsort_dir: z.enum(['asc', 'desc']).optional().describe('Provider slice direction; defaults to desc'),\n\tsort_by: z.enum(['modified_at', 'created_at']).optional().describe('Shipment field used to sort the provider slice')\n})\n\nexport const shipstationListShipmentsPageOutputSchema = z.object({\n\titems: z.array(shipstationShipmentRawSchema),\n\tpagination: shipstationPaginationSchema\n})\n\nexport const shipstationListLabelsResponseSchema = z.looseObject({\n\tlabels: z.array(shipstationLabelRawSchema),\n\ttotal: z.int().nonnegative(),\n\tpage: z.int().min(1),\n\tpages: z.int().nonnegative()\n})\n\nexport const shipstationListShipmentsResponseSchema = z.looseObject({\n\tshipments: z.array(shipstationShipmentRawSchema),\n\ttotal: z.int().nonnegative(),\n\tpage: z.int().min(1),\n\tpages: z.int().nonnegative()\n})\n\nexport type ShipstationLabelRaw = z.infer<typeof shipstationLabelRawSchema>\nexport type ShipstationShipmentRaw = z.infer<typeof shipstationShipmentRawSchema>\nexport type ShipstationPagination = z.infer<typeof shipstationPaginationSchema>\nexport type ShipstationListLabelsPageInput = z.infer<typeof shipstationListLabelsPageInputSchema>\nexport type ShipstationListLabelsPageOutput = z.infer<typeof shipstationListLabelsPageOutputSchema>\nexport type ShipstationListShipmentsPageInput = z.infer<typeof shipstationListShipmentsPageInputSchema>\nexport type ShipstationListShipmentsPageOutput = z.infer<typeof shipstationListShipmentsPageOutputSchema>\n","/**\n * ShipStation V2 vendor client.\n * Host: `new ShipstationClient(auth)`. Agent tools: `fromContext(ctx)`.\n */\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 type {\n\tShipstationAuth,\n\tShipstationListLabelsPageInput,\n\tShipstationListLabelsPageOutput,\n\tShipstationListShipmentsPageInput,\n\tShipstationListShipmentsPageOutput\n} from './contracts'\nimport {\n\tshipstationAuthSchema,\n\tshipstationListLabelsPageInputSchema,\n\tshipstationListLabelsResponseSchema,\n\tshipstationListShipmentsPageInputSchema,\n\tshipstationListShipmentsResponseSchema\n} from './contracts'\n\nconst SHIPSTATION_API_BASE = 'https://api.shipstation.com/v2'\nconst DEFAULT_PAGE_SIZE = 25\n\nexport type ShipstationClientOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class ShipstationClient {\n\treadonly #http: HttpService\n\n\tconstructor(auth: ShipstationAuth, options: ShipstationClientOptions = {}) {\n\t\tconst parsed = shipstationAuthSchema.safeParse(auth)\n\t\tif (!parsed.success) {\n\t\t\tthrow new ToolError('Invalid ShipStation 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\n\t\tthis.#http = new HttpService({\n\t\t\t...options,\n\t\t\tbaseURL: SHIPSTATION_API_BASE,\n\t\t\theaders: {\n\t\t\t\tAccept: 'application/json',\n\t\t\t\t'API-Key': parsed.data.api_key\n\t\t\t},\n\t\t\tlabel: 'ShipStation'\n\t\t})\n\t}\n\n\tstatic fromContext(ctx: ToolContext): ShipstationClient {\n\t\tconst auth = requireAuth(ctx, shipstationAuthSchema)\n\t\treturn new ShipstationClient(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/** One GET /labels request with provider pagination and filters. */\n\tasync listLabelsPage(input: ShipstationListLabelsPageInput = {}): Promise<ShipstationListLabelsPageOutput> {\n\t\tconst parsedInput = shipstationListLabelsPageInputSchema.safeParse(input)\n\t\tif (!parsedInput.success) {\n\t\t\tthrow new ToolError('Invalid ShipStation labels page input', {\n\t\t\t\tcode: 'bad_input',\n\t\t\t\tdetails: { issues: parsedInput.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\n\t\tconst page = parsedInput.data.page ?? 1\n\t\tconst pageSize = parsedInput.data.page_size ?? DEFAULT_PAGE_SIZE\n\t\tconst { data } = await this.#http.get('/labels', {\n\t\t\tlabel: 'ShipStation listLabelsPage',\n\t\t\tquery: { ...parsedInput.data, page, page_size: pageSize }\n\t\t})\n\t\tconst parsedResponse = shipstationListLabelsResponseSchema.safeParse(data)\n\t\tif (!parsedResponse.success) {\n\t\t\tthrow new ToolError('ShipStation returned an invalid labels page', {\n\t\t\t\tcode: 'upstream',\n\t\t\t\tdetails: { issues: parsedResponse.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\titems: parsedResponse.data.labels,\n\t\t\tpagination: {\n\t\t\t\ttotal: parsedResponse.data.total,\n\t\t\t\tpage: parsedResponse.data.page,\n\t\t\t\tpages: parsedResponse.data.pages,\n\t\t\t\tpage_size: pageSize,\n\t\t\t\thas_more: parsedResponse.data.page < parsedResponse.data.pages\n\t\t\t}\n\t\t}\n\t}\n\n\t/** One GET /shipments request with provider pagination and filters. */\n\tasync listShipmentsPage(input: ShipstationListShipmentsPageInput = {}): Promise<ShipstationListShipmentsPageOutput> {\n\t\tconst parsedInput = shipstationListShipmentsPageInputSchema.safeParse(input)\n\t\tif (!parsedInput.success) {\n\t\t\tthrow new ToolError('Invalid ShipStation shipments page input', {\n\t\t\t\tcode: 'bad_input',\n\t\t\t\tdetails: { issues: parsedInput.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\n\t\tconst page = parsedInput.data.page ?? 1\n\t\tconst pageSize = parsedInput.data.page_size ?? DEFAULT_PAGE_SIZE\n\t\tconst { data } = await this.#http.get('/shipments', {\n\t\t\tlabel: 'ShipStation listShipmentsPage',\n\t\t\tquery: { ...parsedInput.data, page, page_size: pageSize }\n\t\t})\n\t\tconst parsedResponse = shipstationListShipmentsResponseSchema.safeParse(data)\n\t\tif (!parsedResponse.success) {\n\t\t\tthrow new ToolError('ShipStation returned an invalid shipments page', {\n\t\t\t\tcode: 'upstream',\n\t\t\t\tdetails: { issues: parsedResponse.error.issues.map((issue) => issue.message) }\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\titems: parsedResponse.data.shipments,\n\t\t\tpagination: {\n\t\t\t\ttotal: parsedResponse.data.total,\n\t\t\t\tpage: parsedResponse.data.page,\n\t\t\t\tpages: parsedResponse.data.pages,\n\t\t\t\tpage_size: pageSize,\n\t\t\t\thas_more: parsedResponse.data.page < parsedResponse.data.pages\n\t\t\t}\n\t\t}\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { ShipstationClient } from './client'\nimport {\n\tshipstationAuthSchema,\n\tshipstationListLabelsPageInputSchema,\n\tshipstationListLabelsPageOutputSchema,\n\tshipstationListShipmentsPageInputSchema,\n\tshipstationListShipmentsPageOutputSchema\n} from './contracts'\n\nexport const shipstationListLabelsTool = defineTool({\n\tid: 'shipstation-list-labels',\n\tname: 'shipstationListLabels',\n\tdescription:\n\t\t'List one page of ShipStation labels. Filter by creation time, status, carrier, service, tracking number, shipment, warehouse, batch, rate, or refund status.',\n\tinputSchema: shipstationListLabelsPageInputSchema,\n\toutputSchema: shipstationListLabelsPageOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\tidempotent: true,\n\tnetwork: true,\n\tsupportsCancel: true,\n\ttags: ['labels', 'shipping', 'tracking', 'fulfillment'],\n\texecute: async (input, ctx) => ShipstationClient.fromContext(ctx).listLabelsPage(input)\n})\n\nexport const shipstationListShipmentsTool = defineTool({\n\tid: 'shipstation-list-shipments',\n\tname: 'shipstationListShipments',\n\tdescription:\n\t\t'List one page of ShipStation shipments. Filter by creation, modification, or payment time plus status, order, store, recipient, item, batch, pickup, or shipment identifiers.',\n\tinputSchema: shipstationListShipmentsPageInputSchema,\n\toutputSchema: shipstationListShipmentsPageOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\tidempotent: true,\n\tnetwork: true,\n\tsupportsCancel: true,\n\ttags: ['shipments', 'shipping', 'orders', 'fulfillment'],\n\texecute: async (input, ctx) => ShipstationClient.fromContext(ctx).listShipmentsPage(input)\n})\n\nexport const shipstationModule = defineModule({\n\tid: 'shipstation',\n\ttitle: 'ShipStation',\n\tdescription: 'ShipStation V2 vendor pack for paginated label and shipment reads.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: shipstationAuthSchema },\n\tcategories: ['commerce', 'shipping'],\n\tclassification: 'pii',\n\ttags: ['labels', 'shipments', 'tracking', 'fulfillment'],\n\ttools: [shipstationListLabelsTool, shipstationListShipments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AM;GACN,SAAS,EAAE,QAAQ,eAAe,MAAM,OAAO,KAAK,UAAU,MAAM,OAAO,EAAE;EAC9E,CAAC;EAGF,OAAO;GACN,OAAO,eAAe,KAAK;GAC3B,YAAY;IACX,OAAO,eAAe,KAAK;IAC3B,MAAM,eAAe,KAAK;IAC1B,OAAO,eAAe,KAAK;IAC3B,WAAW;IACX,UAAU,eAAe,KAAK,OAAO,eAAe,KAAK;GAC1D;EACD;CACD;AACD;;;AC1HA,MAAa,4BAA4B,WAAW;CACnD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,MAAM;EAAC;EAAU;EAAY;EAAY;CAAa;CACtD,SAAS,OAAO,OAAO,QAAQ,kBAAkB,YAAY,GAAG,CAAC,CAAC,eAAe,KAAK;AACvF,CAAC;AAED,MAAa,+BAA+B,WAAW;CACtD,IAAI;CACJ,MAAM;CACN,aACC;CACD,aAAa;CACb,cAAc;CACd,YAAY;CACZ,SAAS;CACT,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,MAAM;EAAC;EAAa;EAAY;EAAU;CAAa;CACvD,SAAS,OAAO,OAAO,QAAQ,kBAAkB,YAAY,GAAG,CAAC,CAAC,kBAAkB,KAAK;AAC1F,CAAC;AAED,MAAa,oBAAoB,aAAa;CAC7C,IAAI;CACJ,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;EAAE,MAAM;EAAU,QAAQ;CAAsB;CACtD,YAAY,CAAC,YAAY,UAAU;CACnC,gBAAgB;CAChB,MAAM;EAAC;EAAU;EAAa;EAAY;CAAa;CACvD,OAAO,CAAC,2BAA2B,4BAA4B;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5ss/ai-tools",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
4
4
  "description": "Reusable AI tools with strict schemas and model-facing contracts. Define once; project to Node, edge, Mastra, AI SDK, TanStack AI, Cloudflare Workers AI, or MCP.",
5
5
  "license": "MIT",
6
6
  "author": "harryy",
@@ -166,6 +166,10 @@
166
166
  "types": "./dist/modules/scheduler/index.d.ts",
167
167
  "default": "./dist/modules/scheduler/index.js"
168
168
  },
169
+ "./shipstation": {
170
+ "types": "./dist/vendors/shipstation/index.d.ts",
171
+ "default": "./dist/vendors/shipstation/index.js"
172
+ },
169
173
  "./skills": {
170
174
  "types": "./dist/modules/skills/index.d.ts",
171
175
  "default": "./dist/modules/skills/index.js"