@ouraihub/llm 0.2.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/LICENSE +21 -0
- package/dist/cjs/index.cjs +995 -0
- package/dist/esm/index.mjs +972 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/anthropic-provider.d.ts +27 -0
- package/dist/types/anthropic-provider.d.ts.map +1 -0
- package/dist/types/base-provider.d.ts +72 -0
- package/dist/types/base-provider.d.ts.map +1 -0
- package/dist/types/errors.d.ts +20 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interfaces.d.ts +140 -0
- package/dist/types/interfaces.d.ts.map +1 -0
- package/dist/types/logger.d.ts +25 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/mcp-client.d.ts +81 -0
- package/dist/types/mcp-client.d.ts.map +1 -0
- package/dist/types/openai-provider.d.ts +29 -0
- package/dist/types/openai-provider.d.ts.map +1 -0
- package/dist/types/skill-loader.d.ts +82 -0
- package/dist/types/skill-loader.d.ts.map +1 -0
- package/dist/types/tool-executor.d.ts +41 -0
- package/dist/types/tool-executor.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/standard-schema.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ar.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/az.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/be.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/bg.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ca.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/cs.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/da.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/de.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/el.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/en.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/eo.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/es.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fa.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fi.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/fr-CA.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/he.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hr.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hu.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/hy.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/id.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/is.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/it.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ja.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ka.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/kh.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/km.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ko.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/lt.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/mk.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ms.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/nl.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/no.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ota.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ps.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pl.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/pt.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ro.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ru.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sl.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/sv.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ta.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/th.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/tr.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ua.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uk.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/ur.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/uz.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/vi.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-CN.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/zh-TW.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/yo.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/locales/index.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-generator.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/index.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/checks.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/compat.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.d.cts","../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.d.cts","../src/interfaces.ts","../src/logger.ts","../src/errors.ts","../src/base-provider.ts","../src/anthropic-provider.ts","../src/openai-provider.ts","../src/tool-executor.ts","../src/mcp-client.ts","../src/skill-loader.ts","../src/index.ts"],"fileIdsList":[[126],[117],[117,120],[52,112,115,117,118,119,120,121,122,123,124,125],[48,50,120],[117,118],[49,117,119],[50,52,54,55,56,57],[52,54,56,57],[52,54,56],[49,52,54,55,57],[48,50,51,52,53,54,55,56,57,58,59,112,113,114,115,116],[48,50,51,54],[50,51,54],[54,57],[48,49,51,52,53,55,56,57],[48,49,50,54,117],[54,55,56,57],[56],[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111],[128,131],[127,128,129,130],[128,129,130,131,132,133,134,135,136],[127],[128,130],[128]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"c1a2e05eb6d7ca8d7e4a7f4c93ccf0c2857e842a64c98eaee4d85841ee9855e6","impliedFormat":1},{"version":"835fb2909ce458740fb4a49fc61709896c6864f5ce3db7f0a88f06c720d74d02","impliedFormat":1},{"version":"6e5857f38aa297a859cab4ec891408659218a5a2610cd317b6dcbef9979459cc","impliedFormat":1},{"version":"ead8e39c2e11891f286b06ae2aa71f208b1802661fcdb2425cffa4f494a68854","impliedFormat":1},{"version":"40ba6c32eb732a09e4446ade5cb6ad0c147f186f9c9dc6878b90b4418ad9f6ea","impliedFormat":1},{"version":"fdd814741843f85c98281522c58f5a646590ba9019fad2efaa95987655e0611b","impliedFormat":1},{"version":"c78aff4fb58b28b8f642d5095fc7eeb79f00e652a67caa19693af1adabb833c9","impliedFormat":1},{"version":"f80a08ced8818dc99359c0acd5b3f12762e1ce53758007759b0d4e503cbf4a5e","impliedFormat":1},{"version":"37935fa7564bcc6e0bc845b766a24391098d26f7c8245d6e8ab37bc016816e94","impliedFormat":1},{"version":"68add36d9632bc096d7245d24d6b0b8ad5f125183016102a3dad4c9c2438ccb0","impliedFormat":1},{"version":"3a819c2928ee06bbcc84e2797fd3558ae2ebb7e0ed8d87f71732fb2e2acc87b4","impliedFormat":1},{"version":"0f8a263f4c8595c8a07de52e3f3927640c44386c1aa2984de9eae50d75e613b2","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"e0bfe601a9fdf6defe94ed62dc60ac71597566001a1f86e705c95e431a9c816d","impliedFormat":1},{"version":"346fffde7c32da87c2196eb7494422449dc2ca82d3b4e6bf55be1d1a33ffc2b0","impliedFormat":1},{"version":"add0ce7b77ba5b308492fa68f77f24d1ed1d9148534bdf05ac17c30763fc1a79","impliedFormat":1},{"version":"8b5875e4958528042103fdd775e106a7f76bafc29709f0690df9a7d2241d52a7","impliedFormat":1},{"version":"2f67911e4bf4e0717dc2ded248ce2d5e4398d945ee13889a6852c1233ea41508","impliedFormat":1},{"version":"d8430c275b0f59417ea8e173cfb888a4477b430ec35b595bf734f3ec7a7d729f","impliedFormat":1},{"version":"69364df1c776372d7df1fb46a6cb3a6bf7f55e700f533a104e3f9d70a32bec18","impliedFormat":1},{"version":"6042774c61ece4ba77b3bf375f15942eb054675b7957882a00c22c0e4fe5865c","impliedFormat":1},{"version":"5a3bd57ed7a9d9afef74c75f77fce79ba3c786401af9810cdf45907c4e93f30e","impliedFormat":1},{"version":"aef26cf95593c8ace1c62c4724f9afac77bdfa756fb8a00613cd152117cb2f43","impliedFormat":1},{"version":"30db853bb2e60170ba11e39ab48bacecb32d06d4def89eedf17e58ebab762a65","impliedFormat":1},{"version":"e27451b24234dfed45f6cf22112a04955183a99c42a2691fb4936d63cfe42761","impliedFormat":1},{"version":"2316301dd223d31962d917999acf8e543e0119c5d24ec984c9f22cb23247160c","impliedFormat":1},{"version":"58d65a2803c3b6629b0e18c8bf1bc883a686fcf0333230dd0151ab6e85b74307","impliedFormat":1},{"version":"e818471014c77c103330aee11f00a7a00b37b35500b53ea6f337aefacd6174c9","impliedFormat":1},{"version":"268fd6d9f2e807a39a6c5aa654b00f949feb63d3faa7dd0f9bba7dde9172159c","impliedFormat":1},{"version":"29f823cbe0166e10e7176a94afe609a24b9e5af3858628c541ff8ce1727023cd","impliedFormat":1},{"version":"6054b0c6f662096e057fc52fd174ad9b344db6e4efc25e880a1634fc37774964","signature":"48d830580e82caee6e84bfad882a00dab211b74f91634f758d9d34875f690bc6"},{"version":"fee1a8dd6d0dcebbd6056f8abcc4a003c6d6bfa02e17352eaf0a0f75e2cbf566","signature":"22abdac00874cc80ed59dcbe68136fc4a65cb74b5e52c63afbb4582f8be68d26"},{"version":"95e987f88ffa2b4545cffef8ee5b330952cdd40e4324916778cc59cafc9a2c9c","signature":"a1e4fd8d084649d2523f99ec77c5e58e945608b4b7794b3f79a74e04d3c1b31c"},{"version":"b9406ebda11267c32f6da774eca4608af3357273e39aa315e1f08d02e0367e5d","signature":"b958f4a2f96bdc73c642ea12b3c9b8f98f5942603bd1f1a22d1f7e87a9ab0573"},{"version":"f3eebc3b5d10d3741e5e0de4a6855a781b3141fa5ca3f330c16f51b66ef94581","signature":"e98d06d2b3ea0c9b11521d94a2b3d8717fd7b0c0aa8a3e00276095bed8c9a465"},{"version":"0e31583c526a1d058b66349ce4f6bf34fcd58ebe8a8e71437a4330091e7f765b","signature":"c77ad05c6de23de10da75019445159f5e8e9e9d262c022a80fb8d5d9045a3d27"},{"version":"63d56fa0d809768dec12709f41158ac8698e12ea2faa5273cdb39adc5759acbc","signature":"752449e61a942ca3bbd0a3d2916adcef6ccb5f1e892bbe5f244d1bce3f4f0d56"},{"version":"23cb0d6913eed2efa958476b9fbdb22b389150a7aaae5fce36db175caf64882d","signature":"8b028202d961d9e29dfd1c3d7b4a4dee6444e3eadaf8eb5d9c87fc8a8719b1ef"},{"version":"9818a87db0370b39ce80a0d86bb8ab3ae7f8ca34937b183ae115d99f54e3a3fe","signature":"ebaceb4307f80f8f10887792dfa95aef948885b16c3f985ad77d60271005bbdf"},{"version":"9e776013aed9f72589e01cad360a4b1b63e5aefca13957a70397ab1cf9602408","signature":"6df03ca761541bf3d4f96f6a308a0c8f70f4a7aa94296239e0406f791da2f8d5"}],"root":[[128,137]],"options":{"allowJs":false,"allowSyntheticDefaultImports":true,"alwaysStrict":true,"checkJs":false,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noImplicitThis":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"strictBindCallApply":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":7},"referencedMap":[[127,1],[121,2],[125,3],[122,3],[118,2],[126,4],[123,5],[124,3],[119,6],[120,7],[114,8],[55,9],[57,10],[56,11],[117,12],[116,13],[115,14],[58,9],[50,15],[54,16],[51,17],[52,18],[60,19],[61,19],[62,19],[63,19],[64,19],[65,19],[66,19],[67,19],[68,19],[69,19],[70,19],[71,19],[72,19],[73,19],[75,19],[74,19],[76,19],[77,19],[78,19],[79,19],[80,19],[112,20],[81,19],[82,19],[83,19],[84,19],[85,19],[86,19],[87,19],[88,19],[89,19],[90,19],[91,19],[92,19],[93,19],[95,19],[94,19],[96,19],[97,19],[98,19],[99,19],[100,19],[101,19],[102,19],[103,19],[104,19],[105,19],[106,19],[107,19],[108,19],[111,19],[109,19],[110,19],[132,21],[131,22],[137,23],[128,24],[135,25],[133,21],[136,26],[134,22]],"latestChangedDtsFile":"./types/index.d.ts","version":"6.0.3"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Anthropic Provider.
|
|
3
|
+
*
|
|
4
|
+
* Supports Anthropic's native Messages API format.
|
|
5
|
+
* Tool calling uses Anthropic's tool_use content blocks.
|
|
6
|
+
*/
|
|
7
|
+
import type { LLMPrompt, LLMMessage, LLMCompletionOptions, LLMCompletionResult, StreamChunk } from './interfaces.js';
|
|
8
|
+
import { BaseLLMProvider, type BaseLLMProviderConfig } from './base-provider.js';
|
|
9
|
+
import type { LLMProviderConfig } from './interfaces.js';
|
|
10
|
+
export declare class AnthropicProvider extends BaseLLMProvider {
|
|
11
|
+
constructor(config: Pick<LLMProviderConfig, 'apiKey'> & Partial<BaseLLMProviderConfig>);
|
|
12
|
+
protected getDefaultBaseUrl(): string;
|
|
13
|
+
protected getDefaultModel(): string;
|
|
14
|
+
protected getVendorName(): string;
|
|
15
|
+
protected buildRequest(prompt: LLMPrompt, options?: LLMCompletionOptions): {
|
|
16
|
+
url: string;
|
|
17
|
+
init: RequestInit;
|
|
18
|
+
};
|
|
19
|
+
protected buildMessagesRequest(messages: readonly LLMMessage[], options?: LLMCompletionOptions): {
|
|
20
|
+
url: string;
|
|
21
|
+
init: RequestInit;
|
|
22
|
+
};
|
|
23
|
+
private buildAnthropicRequest;
|
|
24
|
+
protected parseResponse(payload: unknown): LLMCompletionResult;
|
|
25
|
+
protected parseStreamLine(line: string): StreamChunk | null;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=anthropic-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../src/anthropic-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClI,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYtF,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAIrC,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC,SAAS,CAAC,aAAa,IAAI,MAAM;IAIjC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;IAK7G,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;IAanI,OAAO,CAAC,qBAAqB;IAwC7B,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB;IAgC9D,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;CAmD5D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Base LLM Provider (Template Method Pattern).
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates common flow:
|
|
5
|
+
* - Structured logging at all key points
|
|
6
|
+
* - Retry with exponential backoff (429 / 5xx)
|
|
7
|
+
* - AbortController timeout per attempt
|
|
8
|
+
* - JSON extraction from model output
|
|
9
|
+
* - Zod schema validation
|
|
10
|
+
*
|
|
11
|
+
* Subclasses implement:
|
|
12
|
+
* - buildRequest() — vendor-specific request
|
|
13
|
+
* - parseResponse() — vendor-specific response parsing
|
|
14
|
+
* - getDefaultBaseUrl() / getDefaultModel() / getVendorName()
|
|
15
|
+
*/
|
|
16
|
+
import type { z } from 'zod';
|
|
17
|
+
import type { ILLMProvider, LLMPrompt, LLMMessage, LLMCompletionOptions, LLMCompletionResult, LLMProviderConfig, StreamChunk } from './interfaces.js';
|
|
18
|
+
import type { ILogger } from './logger.js';
|
|
19
|
+
/** Extended config with logger and retry */
|
|
20
|
+
export interface BaseLLMProviderConfig extends LLMProviderConfig {
|
|
21
|
+
readonly logger?: ILogger;
|
|
22
|
+
readonly maxRetries?: number;
|
|
23
|
+
}
|
|
24
|
+
/** Internal invocation result from subclass */
|
|
25
|
+
export interface ParsedInvocation {
|
|
26
|
+
readonly content: string;
|
|
27
|
+
readonly toolCalls?: LLMCompletionResult['toolCalls'];
|
|
28
|
+
readonly finishReason?: string;
|
|
29
|
+
readonly usage?: LLMCompletionResult['usage'];
|
|
30
|
+
}
|
|
31
|
+
export declare abstract class BaseLLMProvider implements ILLMProvider {
|
|
32
|
+
protected readonly apiKey: string;
|
|
33
|
+
protected readonly baseUrl: string;
|
|
34
|
+
protected readonly model: string;
|
|
35
|
+
protected readonly vendor: string;
|
|
36
|
+
protected readonly timeoutMs: number;
|
|
37
|
+
protected readonly logger: ILogger;
|
|
38
|
+
protected readonly maxRetries: number;
|
|
39
|
+
protected constructor(config: Required<Pick<LLMProviderConfig, 'apiKey'>> & BaseLLMProviderConfig);
|
|
40
|
+
/** Structured completion with Zod schema validation */
|
|
41
|
+
complete<T>(prompt: LLMPrompt, schema: z.ZodSchema<T>, options?: LLMCompletionOptions): Promise<T>;
|
|
42
|
+
/** Raw completion without schema enforcement */
|
|
43
|
+
raw(prompt: LLMPrompt, options?: LLMCompletionOptions): Promise<LLMCompletionResult>;
|
|
44
|
+
/** Multi-turn completion: native message history support */
|
|
45
|
+
messages(messages: readonly LLMMessage[], options?: LLMCompletionOptions): Promise<LLMCompletionResult>;
|
|
46
|
+
/** Streaming completion: yields text chunks */
|
|
47
|
+
stream(prompt: LLMPrompt, options?: LLMCompletionOptions): AsyncIterable<StreamChunk>;
|
|
48
|
+
/** Streaming with full message history */
|
|
49
|
+
streamMessages(messages: readonly LLMMessage[], options?: LLMCompletionOptions): AsyncIterable<StreamChunk>;
|
|
50
|
+
private executeStream;
|
|
51
|
+
private executeRequest;
|
|
52
|
+
protected abstract buildRequest(prompt: LLMPrompt, options?: LLMCompletionOptions): {
|
|
53
|
+
url: string;
|
|
54
|
+
init: RequestInit;
|
|
55
|
+
};
|
|
56
|
+
protected abstract buildMessagesRequest(messages: readonly LLMMessage[], options?: LLMCompletionOptions): {
|
|
57
|
+
url: string;
|
|
58
|
+
init: RequestInit;
|
|
59
|
+
};
|
|
60
|
+
protected abstract parseResponse(payload: unknown): LLMCompletionResult;
|
|
61
|
+
/** Parse a single SSE line into a StreamChunk (return null to skip) */
|
|
62
|
+
protected abstract parseStreamLine(line: string): StreamChunk | null;
|
|
63
|
+
protected abstract getDefaultBaseUrl(): string;
|
|
64
|
+
protected abstract getDefaultModel(): string;
|
|
65
|
+
protected abstract getVendorName(): string;
|
|
66
|
+
private fetchWithRetry;
|
|
67
|
+
private fetchWithTimeout;
|
|
68
|
+
private parseAndValidate;
|
|
69
|
+
}
|
|
70
|
+
/** Extract JSON object from LLM output (handles fences, preambles, trailing) */
|
|
71
|
+
export declare function extractJsonObject(raw: string): string;
|
|
72
|
+
//# sourceMappingURL=base-provider.d.ts.map
|
|
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mBAAmB;IACvE,uEAAuE;IACvE,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IACpE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,MAAM;IAC9C,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,MAAM;IAC5C,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,MAAM;YAI5B,cAAc;YA2Cd,gBAAgB;IAoB9B,OAAO,CAAC,gBAAgB;CA0BzB;AAID,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Error definitions.
|
|
3
|
+
*/
|
|
4
|
+
/** Base LLM error */
|
|
5
|
+
export declare class LLMError extends Error {
|
|
6
|
+
readonly vendor: string;
|
|
7
|
+
readonly statusCode?: number;
|
|
8
|
+
readonly durationMs?: number;
|
|
9
|
+
constructor(message: string, vendor: string, statusCode?: number, durationMs?: number);
|
|
10
|
+
}
|
|
11
|
+
/** Timeout error */
|
|
12
|
+
export declare class LLMTimeoutError extends LLMError {
|
|
13
|
+
readonly timeoutMs: number;
|
|
14
|
+
constructor(vendor: string, timeoutMs: number);
|
|
15
|
+
}
|
|
16
|
+
/** Schema validation error */
|
|
17
|
+
export declare class LLMSchemaError extends LLMError {
|
|
18
|
+
constructor(vendor: string, details: string);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAqB;AACrB,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAOtF;AAED,oBAAoB;AACpB,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAK9C;AAED,8BAA8B;AAC9B,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Package entry point.
|
|
3
|
+
*
|
|
4
|
+
* A complete LLM abstraction with:
|
|
5
|
+
* - Multi-provider support (OpenAI-compatible + Anthropic)
|
|
6
|
+
* - Structured output (Zod schema validation)
|
|
7
|
+
* - Tool calling / MCP support
|
|
8
|
+
* - Skill system (SKILL.md → system prompt)
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* import { createProvider, ToolExecutor, SkillLoader, MCPClient } from '@ouraihub/llm';
|
|
12
|
+
*
|
|
13
|
+
* // Basic structured output
|
|
14
|
+
* const llm = createProvider({ apiKey, baseUrl, model });
|
|
15
|
+
* const result = await llm.complete(prompt, schema);
|
|
16
|
+
*
|
|
17
|
+
* // With skills
|
|
18
|
+
* const skills = new SkillLoader();
|
|
19
|
+
* skills.add('my-skill', skillContent);
|
|
20
|
+
* const prompt = skills.buildPrompt('user question');
|
|
21
|
+
* await llm.complete(prompt, schema);
|
|
22
|
+
*
|
|
23
|
+
* // With MCP tools
|
|
24
|
+
* const mcp = new MCPClient();
|
|
25
|
+
* await mcp.connect({ url: 'http://localhost:3000/mcp' });
|
|
26
|
+
* const executor = new ToolExecutor();
|
|
27
|
+
* executor.register(mcp.getToolRegistrations());
|
|
28
|
+
* await executor.completeWithTools(llm, prompt, schema);
|
|
29
|
+
*/
|
|
30
|
+
import type { ILLMProvider, CreateProviderOptions } from './interfaces.js';
|
|
31
|
+
/**
|
|
32
|
+
* Create an LLM provider instance.
|
|
33
|
+
*
|
|
34
|
+
* @param options.provider - 'openai' (default, supports any OpenAI-compatible relay) or 'anthropic'
|
|
35
|
+
* @param options.apiKey - API key (required)
|
|
36
|
+
* @param options.baseUrl - Custom base URL (optional, for relay/proxy services)
|
|
37
|
+
* @param options.model - Model name (optional, defaults to vendor's recommended)
|
|
38
|
+
* @param options.timeoutMs - Request timeout (default: 30000ms)
|
|
39
|
+
*/
|
|
40
|
+
export declare function createProvider(options: CreateProviderOptions): ILLMProvider;
|
|
41
|
+
export { OpenAIProvider } from './openai-provider.js';
|
|
42
|
+
export { AnthropicProvider } from './anthropic-provider.js';
|
|
43
|
+
export { ToolExecutor } from './tool-executor.js';
|
|
44
|
+
export { MCPClient } from './mcp-client.js';
|
|
45
|
+
export { SkillLoader } from './skill-loader.js';
|
|
46
|
+
export { LLMError, LLMTimeoutError, LLMSchemaError } from './errors.js';
|
|
47
|
+
export { noopLogger, consoleLogger } from './logger.js';
|
|
48
|
+
export { extractJsonObject } from './base-provider.js';
|
|
49
|
+
export type { ILLMProvider, LLMPrompt, LLMMessage, LLMCompletionOptions, LLMCompletionResult, LLMUsage, LLMProviderConfig, CreateProviderOptions, StreamChunk, StreamToolCallDelta, IToolExecutor, LLMTool, LLMToolCall, ToolHandler, ToolRegistration, } from './interfaces.js';
|
|
50
|
+
export type { SkillEntry, SkillPromptOptions, } from './skill-loader.js';
|
|
51
|
+
export type { MCPToolDefinition, MCPToolResult, MCPServerConfig, } from './mcp-client.js';
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI3E;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,YAAY,CAU3E;AAID,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIxE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD,YAAY,EAEV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EAErB,WAAW,EACX,mBAAmB,EAEnB,aAAa,EACb,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Interface definitions.
|
|
3
|
+
*
|
|
4
|
+
* All modules communicate through these typed contracts.
|
|
5
|
+
* Consumers depend on interfaces, never on concrete implementations.
|
|
6
|
+
*/
|
|
7
|
+
import type { z } from 'zod';
|
|
8
|
+
/** A prompt pair for LLM completion */
|
|
9
|
+
export interface LLMPrompt {
|
|
10
|
+
readonly system: string;
|
|
11
|
+
readonly user: string;
|
|
12
|
+
}
|
|
13
|
+
/** Message in a multi-turn conversation */
|
|
14
|
+
export interface LLMMessage {
|
|
15
|
+
readonly role: 'system' | 'user' | 'assistant' | 'tool';
|
|
16
|
+
readonly content: string;
|
|
17
|
+
readonly name?: string;
|
|
18
|
+
readonly tool_call_id?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Tool definition (MCP-compatible shape) */
|
|
21
|
+
export interface LLMTool {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly parameters: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/** Tool call request from the model */
|
|
27
|
+
export interface LLMToolCall {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly arguments: string;
|
|
31
|
+
}
|
|
32
|
+
/** Completion options */
|
|
33
|
+
export interface LLMCompletionOptions {
|
|
34
|
+
/** Override temperature (default: provider-specific) */
|
|
35
|
+
readonly temperature?: number;
|
|
36
|
+
/** Override max tokens */
|
|
37
|
+
readonly maxTokens?: number;
|
|
38
|
+
/** Request JSON mode */
|
|
39
|
+
readonly jsonMode?: boolean;
|
|
40
|
+
/** Tools available for this completion */
|
|
41
|
+
readonly tools?: readonly LLMTool[];
|
|
42
|
+
/** Enable streaming (internal use, set by stream/streamMessages) */
|
|
43
|
+
readonly stream?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Raw completion result (before schema validation) */
|
|
46
|
+
export interface LLMCompletionResult {
|
|
47
|
+
readonly content: string;
|
|
48
|
+
readonly toolCalls?: readonly LLMToolCall[];
|
|
49
|
+
readonly finishReason?: string;
|
|
50
|
+
readonly usage?: LLMUsage;
|
|
51
|
+
}
|
|
52
|
+
/** Token usage info */
|
|
53
|
+
export interface LLMUsage {
|
|
54
|
+
readonly promptTokens?: number;
|
|
55
|
+
readonly completionTokens?: number;
|
|
56
|
+
readonly totalTokens?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* LLM Provider — core interface.
|
|
60
|
+
*
|
|
61
|
+
* Four completion modes:
|
|
62
|
+
* - `complete<T>()` — structured output with Zod schema validation
|
|
63
|
+
* - `raw()` — raw completion without schema enforcement
|
|
64
|
+
* - `messages()` — native multi-turn conversation (for tool call loops)
|
|
65
|
+
* - `stream()` — streaming completion yielding chunks as they arrive
|
|
66
|
+
*/
|
|
67
|
+
export interface ILLMProvider {
|
|
68
|
+
/** Structured completion: prompt → validated T */
|
|
69
|
+
complete<T>(prompt: LLMPrompt, schema: z.ZodSchema<T>, options?: LLMCompletionOptions): Promise<T>;
|
|
70
|
+
/** Raw completion: prompt → string content */
|
|
71
|
+
raw(prompt: LLMPrompt, options?: LLMCompletionOptions): Promise<LLMCompletionResult>;
|
|
72
|
+
/** Multi-turn completion: full message history → result (for tool call loops) */
|
|
73
|
+
messages(messages: readonly LLMMessage[], options?: LLMCompletionOptions): Promise<LLMCompletionResult>;
|
|
74
|
+
/** Streaming completion: yields text chunks as they arrive */
|
|
75
|
+
stream(prompt: LLMPrompt, options?: LLMCompletionOptions): AsyncIterable<StreamChunk>;
|
|
76
|
+
/** Streaming with full message history */
|
|
77
|
+
streamMessages(messages: readonly LLMMessage[], options?: LLMCompletionOptions): AsyncIterable<StreamChunk>;
|
|
78
|
+
}
|
|
79
|
+
/** A single chunk from a streaming response */
|
|
80
|
+
export interface StreamChunk {
|
|
81
|
+
/** Text delta (empty string if no text in this chunk) */
|
|
82
|
+
readonly text: string;
|
|
83
|
+
/** Tool call delta (present when model starts/continues a tool call) */
|
|
84
|
+
readonly toolCall?: StreamToolCallDelta;
|
|
85
|
+
/** Set to true on the final chunk */
|
|
86
|
+
readonly done: boolean;
|
|
87
|
+
/** Finish reason (only on final chunk) */
|
|
88
|
+
readonly finishReason?: string;
|
|
89
|
+
/** Accumulated usage (only on final chunk, if provider supports it) */
|
|
90
|
+
readonly usage?: LLMUsage;
|
|
91
|
+
}
|
|
92
|
+
/** Incremental tool call info from a stream */
|
|
93
|
+
export interface StreamToolCallDelta {
|
|
94
|
+
readonly id?: string;
|
|
95
|
+
readonly name?: string;
|
|
96
|
+
readonly argumentsDelta: string;
|
|
97
|
+
}
|
|
98
|
+
/** Handler for a single tool */
|
|
99
|
+
export type ToolHandler = (args: Record<string, unknown>) => Promise<string>;
|
|
100
|
+
/** Tool registration entry */
|
|
101
|
+
export interface ToolRegistration {
|
|
102
|
+
readonly definition: LLMTool;
|
|
103
|
+
readonly handler: ToolHandler;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Tool Executor — manages tool call loops.
|
|
107
|
+
*
|
|
108
|
+
* When the model requests a tool call, the executor:
|
|
109
|
+
* 1. Looks up the registered handler
|
|
110
|
+
* 2. Executes it with the model's arguments
|
|
111
|
+
* 3. Feeds the result back to the model
|
|
112
|
+
* 4. Repeats until the model produces a final response
|
|
113
|
+
*/
|
|
114
|
+
export interface IToolExecutor {
|
|
115
|
+
/** Register tools for use in completions */
|
|
116
|
+
register(tools: readonly ToolRegistration[]): void;
|
|
117
|
+
/** Run a completion with automatic tool call loop */
|
|
118
|
+
completeWithTools<T>(provider: ILLMProvider, prompt: LLMPrompt, schema: z.ZodSchema<T>, options?: {
|
|
119
|
+
maxRounds?: number;
|
|
120
|
+
}): Promise<T>;
|
|
121
|
+
}
|
|
122
|
+
/** Configuration for creating a provider */
|
|
123
|
+
export interface LLMProviderConfig {
|
|
124
|
+
/** API key (required) */
|
|
125
|
+
readonly apiKey: string;
|
|
126
|
+
/** Base URL (optional, defaults to vendor's official endpoint) */
|
|
127
|
+
readonly baseUrl?: string;
|
|
128
|
+
/** Model name (optional, defaults to vendor's recommended model) */
|
|
129
|
+
readonly model?: string;
|
|
130
|
+
/** Request timeout in ms (default: 30000) */
|
|
131
|
+
readonly timeoutMs?: number;
|
|
132
|
+
/** Vendor identifier for logging */
|
|
133
|
+
readonly vendor?: string;
|
|
134
|
+
}
|
|
135
|
+
/** Factory options */
|
|
136
|
+
export interface CreateProviderOptions extends LLMProviderConfig {
|
|
137
|
+
/** Provider type: 'openai' (default) or 'anthropic' */
|
|
138
|
+
readonly provider?: 'openai' | 'anthropic';
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,6CAA6C;AAC7C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C;AAED,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,yBAAyB;AACzB,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,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AAqD;IACrD,iBAAiB,CAAC,CAAC,EACjB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACtB,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,CAAC,CAAC,CAAC;CACf;AAID,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,sBAAsB;AACtB,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;CAC5C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — Logger interface.
|
|
3
|
+
*
|
|
4
|
+
* This package defines its own minimal ILogger interface.
|
|
5
|
+
* Any logger that satisfies this interface can be injected:
|
|
6
|
+
* - @ouraihub/core's Logger
|
|
7
|
+
* - pino / winston / console
|
|
8
|
+
* - Custom structured loggers
|
|
9
|
+
*
|
|
10
|
+
* The interface is intentionally minimal (info/warn/error + fields)
|
|
11
|
+
* to maximize compatibility across different logging implementations.
|
|
12
|
+
*/
|
|
13
|
+
/** Structured log data — any key-value pairs for context */
|
|
14
|
+
export type LogData = Record<string, unknown>;
|
|
15
|
+
/** Logger interface — consumers inject their implementation */
|
|
16
|
+
export interface ILogger {
|
|
17
|
+
info(message: string, data?: LogData): void;
|
|
18
|
+
warn(message: string, data?: LogData): void;
|
|
19
|
+
error(message: string, data?: LogData): void;
|
|
20
|
+
}
|
|
21
|
+
/** No-op logger (default when no logger is injected) */
|
|
22
|
+
export declare const noopLogger: ILogger;
|
|
23
|
+
/** Console logger (convenient default for development) */
|
|
24
|
+
export declare const consoleLogger: ILogger;
|
|
25
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,4DAA4D;AAC5D,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,+DAA+D;AAC/D,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AAED,wDAAwD;AACxD,eAAO,MAAM,UAAU,EAAE,OAIxB,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — MCP Client.
|
|
3
|
+
*
|
|
4
|
+
* Connects to MCP (Model Context Protocol) servers and converts their
|
|
5
|
+
* tool definitions into the format expected by ILLMProvider and ToolExecutor.
|
|
6
|
+
*
|
|
7
|
+
* Supports:
|
|
8
|
+
* - HTTP/SSE transport (for remote MCP servers)
|
|
9
|
+
* - Direct function registration (for in-process tools)
|
|
10
|
+
* - Tool discovery and schema conversion
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* const mcp = new MCPClient();
|
|
14
|
+
* await mcp.connect('http://localhost:3000/mcp');
|
|
15
|
+
* const tools = mcp.getToolRegistrations();
|
|
16
|
+
* executor.register(tools);
|
|
17
|
+
*/
|
|
18
|
+
import type { LLMTool, ToolRegistration } from './interfaces.js';
|
|
19
|
+
/** MCP server tool definition (from server's tools/list response) */
|
|
20
|
+
export interface MCPToolDefinition {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly description?: string;
|
|
23
|
+
readonly inputSchema?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/** MCP tool call result */
|
|
26
|
+
export interface MCPToolResult {
|
|
27
|
+
readonly content: Array<{
|
|
28
|
+
type: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
}>;
|
|
31
|
+
readonly isError?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** MCP server connection config */
|
|
34
|
+
export interface MCPServerConfig {
|
|
35
|
+
/** Server URL (HTTP endpoint) */
|
|
36
|
+
readonly url: string;
|
|
37
|
+
/** Optional auth token */
|
|
38
|
+
readonly authToken?: string;
|
|
39
|
+
/** Request timeout (default: 15000ms) */
|
|
40
|
+
readonly timeoutMs?: number;
|
|
41
|
+
/** Server name (for logging) */
|
|
42
|
+
readonly name?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* MCPClient — connects to MCP servers and provides tool registrations.
|
|
46
|
+
*
|
|
47
|
+
* This is a lightweight HTTP-based MCP client that supports:
|
|
48
|
+
* - Tool discovery (tools/list)
|
|
49
|
+
* - Tool invocation (tools/call)
|
|
50
|
+
* - Converting MCP tools to ToolRegistration format for ToolExecutor
|
|
51
|
+
*/
|
|
52
|
+
export declare class MCPClient {
|
|
53
|
+
private servers;
|
|
54
|
+
/**
|
|
55
|
+
* Connect to an MCP server and discover its tools.
|
|
56
|
+
* Returns the number of tools discovered.
|
|
57
|
+
*/
|
|
58
|
+
connect(config: MCPServerConfig): Promise<number>;
|
|
59
|
+
/** Disconnect from a server */
|
|
60
|
+
disconnect(name: string): void;
|
|
61
|
+
/** Refresh tool list from a connected server (re-discovery) */
|
|
62
|
+
refresh(name: string): Promise<number>;
|
|
63
|
+
/** Health check: ping a connected server */
|
|
64
|
+
healthCheck(name: string): Promise<boolean>;
|
|
65
|
+
/** Get all connected server names */
|
|
66
|
+
getServerNames(): string[];
|
|
67
|
+
/** Get all tool definitions from all connected servers */
|
|
68
|
+
getAllTools(): LLMTool[];
|
|
69
|
+
/**
|
|
70
|
+
* Get tool registrations ready for ToolExecutor.register().
|
|
71
|
+
* Each tool's handler calls the MCP server via HTTP.
|
|
72
|
+
*/
|
|
73
|
+
getToolRegistrations(): ToolRegistration[];
|
|
74
|
+
/** Discover tools from MCP server */
|
|
75
|
+
private discoverTools;
|
|
76
|
+
/** Call a tool on the MCP server */
|
|
77
|
+
private callTool;
|
|
78
|
+
/** Send JSON-RPC request to MCP server */
|
|
79
|
+
private rpcCall;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=mcp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAG9E,qEAAqE;AACrE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAED,2BAA2B;AAC3B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAA0C;IAEzD;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAQvD,+BAA+B;IAC/B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,+DAA+D;IACzD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU5C,4CAA4C;IACtC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWjD,qCAAqC;IACrC,cAAc,IAAI,MAAM,EAAE;IAI1B,0DAA0D;IAC1D,WAAW,IAAI,OAAO,EAAE;IAcxB;;;OAGG;IACH,oBAAoB,IAAI,gBAAgB,EAAE;IAwB1C,qCAAqC;YACvB,aAAa;IAO3B,oCAAoC;YACtB,QAAQ;IAoBtB,0CAA0C;YAC5B,OAAO;CAuDtB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ouraihub/llm — OpenAI-compatible Provider.
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - OpenAI official API
|
|
6
|
+
* - Any OpenAI Chat Completions compatible relay/proxy
|
|
7
|
+
* - Tool calling (function calling format)
|
|
8
|
+
*/
|
|
9
|
+
import type { LLMPrompt, LLMMessage, LLMCompletionOptions, LLMCompletionResult, StreamChunk } from './interfaces.js';
|
|
10
|
+
import { BaseLLMProvider, type BaseLLMProviderConfig } from './base-provider.js';
|
|
11
|
+
import type { LLMProviderConfig } from './interfaces.js';
|
|
12
|
+
export declare class OpenAIProvider extends BaseLLMProvider {
|
|
13
|
+
constructor(config: Pick<LLMProviderConfig, 'apiKey'> & Partial<BaseLLMProviderConfig>);
|
|
14
|
+
protected getDefaultBaseUrl(): string;
|
|
15
|
+
protected getDefaultModel(): string;
|
|
16
|
+
protected getVendorName(): string;
|
|
17
|
+
protected buildRequest(prompt: LLMPrompt, options?: LLMCompletionOptions): {
|
|
18
|
+
url: string;
|
|
19
|
+
init: RequestInit;
|
|
20
|
+
};
|
|
21
|
+
protected buildMessagesRequest(messages: readonly LLMMessage[], options?: LLMCompletionOptions): {
|
|
22
|
+
url: string;
|
|
23
|
+
init: RequestInit;
|
|
24
|
+
};
|
|
25
|
+
private buildChatRequest;
|
|
26
|
+
protected parseResponse(payload: unknown): LLMCompletionResult;
|
|
27
|
+
protected parseStreamLine(line: string): StreamChunk | null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=openai-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai-provider.d.ts","sourceRoot":"","sources":["../../src/openai-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClI,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,qBAAa,cAAe,SAAQ,eAAe;gBACrC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYtF,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAIrC,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC,SAAS,CAAC,aAAa,IAAI,MAAM;IAIjC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;IAQ7G,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;IAUnI,OAAO,CAAC,gBAAgB;IA6CxB,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB;IA8B9D,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;CA0C5D"}
|